Merge "Update legacy headers in the new directory." into main
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 69ab91b..3ed9ed2 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -195,48 +195,42 @@
 
 template <typename T>
 bool DynamicsProcessingTestHelper::isBandConfigValid(const std::vector<T>& cfgs, int bandCount) {
-    std::vector<float> freqs(cfgs.size(), -1);
+    std::unordered_set<int> freqs;
     for (auto cfg : cfgs) {
         if (cfg.channel < 0 || cfg.channel >= mChannelCount) return false;
         if (cfg.band < 0 || cfg.band >= bandCount) return false;
-        freqs[cfg.band] = cfg.cutoffFrequencyHz;
+        // duplicated band index
+        if (freqs.find(cfg.band) != freqs.end()) return false;
+        freqs.insert(cfg.band);
     }
-    if (std::count(freqs.begin(), freqs.end(), -1)) return false;
-    return std::is_sorted(freqs.begin(), freqs.end());
+    return true;
 }
 
 bool DynamicsProcessingTestHelper::isParamValid(const DynamicsProcessing::Tag& tag,
                                                 const DynamicsProcessing& dp) {
     switch (tag) {
         case DynamicsProcessing::preEq: {
-            if (!mEngineConfigApplied.preEqStage.inUse) return false;
             return isChannelConfigValid(dp.get<DynamicsProcessing::preEq>());
         }
         case DynamicsProcessing::postEq: {
-            if (!mEngineConfigApplied.postEqStage.inUse) return false;
             return isChannelConfigValid(dp.get<DynamicsProcessing::postEq>());
         }
         case DynamicsProcessing::mbc: {
-            if (!mEngineConfigApplied.mbcStage.inUse) return false;
             return isChannelConfigValid(dp.get<DynamicsProcessing::mbc>());
         }
         case DynamicsProcessing::preEqBand: {
-            if (!mEngineConfigApplied.preEqStage.inUse) return false;
             return isBandConfigValid(dp.get<DynamicsProcessing::preEqBand>(),
                                      mEngineConfigApplied.preEqStage.bandCount);
         }
         case DynamicsProcessing::postEqBand: {
-            if (!mEngineConfigApplied.postEqStage.inUse) return false;
             return isBandConfigValid(dp.get<DynamicsProcessing::postEqBand>(),
                                      mEngineConfigApplied.postEqStage.bandCount);
         }
         case DynamicsProcessing::mbcBand: {
-            if (!mEngineConfigApplied.mbcStage.inUse) return false;
             return isBandConfigValid(dp.get<DynamicsProcessing::mbcBand>(),
                                      mEngineConfigApplied.mbcStage.bandCount);
         }
         case DynamicsProcessing::limiter: {
-            if (!mEngineConfigApplied.limiterInUse) return false;
             return isChannelConfigValid(dp.get<DynamicsProcessing::limiter>());
         }
         case DynamicsProcessing::inputGain: {
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index f72cf55..cef552c 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -3002,14 +3002,10 @@
         GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation";
         return;
     }
-
     auto& writer = getWriter(getPrimaryDisplayId());
-    int64_t layer = 5;
-    writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
-    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
-                           VtsComposerClient::kNoFrameIntervalNs);
+    const auto& [status, layer] =
+            mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer);
+    EXPECT_TRUE(status.isOk());
     execute();
     ASSERT_TRUE(mReader.takeErrors().empty());
 }
@@ -3019,15 +3015,13 @@
         GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation";
         return;
     }
-
-    auto& writer = getWriter(getPrimaryDisplayId());
+    auto& writer = getWriter(getInvalidDisplayId());
     int64_t layer = 5;
     writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer,
                                              LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
-    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
-                           VtsComposerClient::kNoFrameIntervalNs);
+    writer.setNewBufferSlotCount(getInvalidDisplayId(), layer, 1);
     execute();
+
     const auto errors = mReader.takeErrors();
     ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY);
 }
@@ -3037,26 +3031,15 @@
         GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation";
         return;
     }
-
     auto& writer = getWriter(getPrimaryDisplayId());
-    int64_t layer = 5;
-    writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
-    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
-                           VtsComposerClient::kNoFrameIntervalNs);
+    const auto& [status, layer] =
+            mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer);
+    EXPECT_TRUE(status.isOk());
     execute();
     ASSERT_TRUE(mReader.takeErrors().empty());
-    writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::DESTROY);
-    layer++;
-    writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
-
+    EXPECT_TRUE(mComposerClient->destroyLayer(getPrimaryDisplayId(), layer, &writer).isOk());
     execute();
-    const auto errors = mReader.takeErrors();
-    ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY);
+    ASSERT_TRUE(mReader.takeErrors().empty());
 }
 
 TEST_P(GraphicsComposerAidlCommandV3Test, DestroyBatchedCommand_BadDisplay) {
@@ -3064,25 +3047,20 @@
         GTEST_SKIP() << "LAYER_LIFECYCLE_BATCH_COMMAND not supported by the implementation";
         return;
     }
-
     auto& writer = getWriter(getPrimaryDisplayId());
-    int64_t layer = 5;
-    writer.setLayerLifecycleBatchCommandType(getPrimaryDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
-    writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp,
-                           VtsComposerClient::kNoFrameIntervalNs);
-    execute();
-    ASSERT_TRUE(mReader.takeErrors().empty());
-    writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::DESTROY);
-    layer++;
-    writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer,
-                                             LayerLifecycleBatchCommandType::CREATE);
-    writer.setNewBufferSlotCount(getPrimaryDisplayId(), layer, 1);
+    const auto& [status, layer] =
+            mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount, &writer);
 
+    EXPECT_TRUE(status.isOk());
     execute();
     ASSERT_TRUE(mReader.takeErrors().empty());
+
+    auto& invalid_writer = getWriter(getInvalidDisplayId());
+    invalid_writer.setLayerLifecycleBatchCommandType(getInvalidDisplayId(), layer,
+                                                     LayerLifecycleBatchCommandType::DESTROY);
+    execute();
+    const auto errors = mReader.takeErrors();
+    ASSERT_TRUE(errors.size() == 1 && errors[0].errorCode == IComposerClient::EX_BAD_DISPLAY);
 }
 
 TEST_P(GraphicsComposerAidlCommandV3Test, NoCreateDestroyBatchedCommandIncorrectLayer) {
diff --git a/security/keymint/aidl/default/main.rs b/security/keymint/aidl/default/main.rs
index ea432d1..055c698 100644
--- a/security/keymint/aidl/default/main.rs
+++ b/security/keymint/aidl/default/main.rs
@@ -44,7 +44,7 @@
 }
 
 fn main() {
-    if let Err(e) = inner_main() {
+    if let Err(HalServiceError(e)) = inner_main() {
         panic!("HAL service failed: {:?}", e);
     }
 }
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index b7b0185..85d0496 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -353,8 +353,7 @@
                 break;
             }
             case FrontendStatusType::UEC: {
-                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::uec>() ==
-                            expectStatuses[i].get<FrontendStatus::Tag::uec>());
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::uec>() >= 0);
                 break;
             }
             case FrontendStatusType::T2_SYSTEM_ID: {
diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
index 5ffb38f..45d8ee6 100644
--- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
+++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
@@ -273,16 +273,10 @@
             vector<FrontendStatusType> types;
             vector<FrontendStatus> statuses;
 
-            types.push_back(FrontendStatusType::DEMOD_LOCK);
             types.push_back(FrontendStatusType::UEC);
-            types.push_back(FrontendStatusType::IS_MISO);
 
             FrontendStatus status;
-            status.set<FrontendStatus::Tag::isDemodLocked>(true);
-            statuses.push_back(status);
-            status.set<FrontendStatus::Tag::uec>(4);
-            statuses.push_back(status);
-            status.set<FrontendStatus::Tag::isMiso>(true);
+            status.set<FrontendStatus::Tag::uec>(0);
             statuses.push_back(status);
 
             auto frontends = *hardwareConfig.getFirstFrontends();
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index d9e023c..d82450e 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -525,6 +525,7 @@
     return true;
 }
 
+// Only use to prepare parameters for Gscan.
 legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) {
     switch (band) {
         case WifiBand::BAND_UNSPECIFIED:
@@ -541,6 +542,15 @@
             return legacy_hal::WIFI_BAND_ABG;
         case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS:
             return legacy_hal::WIFI_BAND_ABG_WITH_DFS;
+        case WifiBand::BAND_6GHZ:
+        case WifiBand::BAND_60GHZ:
+        case WifiBand::BAND_5GHZ_6GHZ:
+        case WifiBand::BAND_24GHZ_5GHZ_6GHZ:
+        case WifiBand::BAND_24GHZ_5GHZ_6GHZ_60GHZ:
+        case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ:
+        case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ_60GHZ:
+            LOG(INFO) << "WifiBand mapping may be incorrect, since 6GHz is not supported by legacy";
+            return legacy_hal::WIFI_BAND_UNSPECIFIED;
         default:
             CHECK(false);
             return {};