Update Vendor HAL service to use ints
for bitmaps instead of using enums.

Bug: 267819850
Test: m
Change-Id: I6fba3cd669d197229ff637c6326a94be624d5e6e
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index 5bfdcbb..dfa08a1 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -408,8 +408,8 @@
     aidl_usable_channel->channel = legacy_usable_channel.freq;
     aidl_usable_channel->channelBandwidth =
             convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width);
-    aidl_usable_channel->ifaceModeMask = static_cast<WifiIfaceMode>(
-            convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask));
+    aidl_usable_channel->ifaceModeMask =
+            convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask);
 
     return true;
 }
@@ -572,7 +572,7 @@
         legacy_bucket_spec.report_events = 0;
         using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask;
         for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) {
-            if (static_cast<int32_t>(aidl_bucket_spec.eventReportScheme) &
+            if (aidl_bucket_spec.eventReportScheme &
                 static_cast<std::underlying_type<AidlFlag>::type>(flag)) {
                 legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag);
             }
@@ -678,7 +678,7 @@
                     convertLegacyGscanDataFlagToAidl(flag));
         }
     }
-    aidl_scan_data->flags = static_cast<StaScanDataFlagMask>(flags);
+    aidl_scan_data->flags = flags;
     aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned;
 
     CHECK(legacy_cached_scan_result.num_results >= 0 &&
diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h
index 3da94dc..9a13672 100644
--- a/wifi/aidl/default/aidl_struct_util.h
+++ b/wifi/aidl/default/aidl_struct_util.h
@@ -20,7 +20,10 @@
 #include <aidl/android/hardware/wifi/IWifiChip.h>
 #include <aidl/android/hardware/wifi/IWifiChipEventCallback.h>
 #include <aidl/android/hardware/wifi/NanBandIndex.h>
+#include <aidl/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.h>
+#include <aidl/android/hardware/wifi/StaScanDataFlagMask.h>
 #include <aidl/android/hardware/wifi/WifiDebugRingBufferFlags.h>
+#include <aidl/android/hardware/wifi/WifiIfaceMode.h>
 
 #include <vector>
 
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index 89edaa4..dd24e6b 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -455,7 +455,7 @@
                            &WifiChip::registerEventCallbackInternal, event_callback);
 }
 
-ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) {
+ndk::ScopedAStatus WifiChip::getCapabilities(int32_t* _aidl_return) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::getCapabilitiesInternal, _aidl_return);
 }
@@ -681,7 +681,7 @@
 
 ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels(
         const std::vector<IWifiChip::CoexUnsafeChannel>& in_unsafeChannels,
-        CoexRestriction in_restrictions) {
+        int32_t in_restrictions) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels,
                            in_restrictions);
@@ -692,8 +692,8 @@
                            &WifiChip::setCountryCodeInternal, in_code);
 }
 
-ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask,
-                                               UsableChannelFilter in_filterMask,
+ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask,
+                                               int32_t in_filterMask,
                                                std::vector<WifiUsableChannel>* _aidl_return) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::getUsableChannelsInternal, _aidl_return, in_band,
@@ -722,8 +722,7 @@
                            &WifiChip::getWifiChipCapabilitiesInternal, _aidl_return);
 }
 
-ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork(
-        ChannelCategoryMask in_channelCategoryEnableFlag) {
+ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork(int32_t in_channelCategoryEnableFlag) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::enableStaChannelForPeerNetworkInternal,
                            in_channelCategoryEnableFlag);
@@ -787,7 +786,7 @@
     return ndk::ScopedAStatus::ok();
 }
 
-std::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> WifiChip::getCapabilitiesInternal() {
+std::pair<int32_t, ndk::ScopedAStatus> WifiChip::getCapabilitiesInternal() {
     legacy_hal::wifi_error legacy_status;
     uint64_t legacy_feature_set;
     uint32_t legacy_logger_feature_set;
@@ -795,7 +794,7 @@
     std::tie(legacy_status, legacy_feature_set) =
             legacy_hal_.lock()->getSupportedFeatureSet(ifname);
     if (legacy_status != legacy_hal::WIFI_SUCCESS) {
-        return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)};
+        return {0, createWifiStatusFromLegacyError(legacy_status)};
     }
     std::tie(legacy_status, legacy_logger_feature_set) =
             legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname);
@@ -806,9 +805,9 @@
     uint32_t aidl_caps;
     if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set,
                                                                        &aidl_caps)) {
-        return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
+        return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
     }
-    return {static_cast<IWifiChip::ChipCapabilityMask>(aidl_caps), ndk::ScopedAStatus::ok()};
+    return {aidl_caps, ndk::ScopedAStatus::ok()};
 }
 
 std::pair<std::vector<IWifiChip::ChipMode>, ndk::ScopedAStatus>
@@ -1385,13 +1384,12 @@
 }
 
 ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal(
-        std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, CoexRestriction restrictions) {
+        std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, int32_t aidl_restrictions) {
     std::vector<legacy_hal::wifi_coex_unsafe_channel> legacy_unsafe_channels;
     if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels,
                                                                         &legacy_unsafe_channels)) {
         return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
     }
-    uint32_t aidl_restrictions = static_cast<uint32_t>(restrictions);
     uint32_t legacy_restrictions = 0;
     if (aidl_restrictions & static_cast<uint32_t>(CoexRestriction::WIFI_DIRECT)) {
         legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT;
@@ -1413,15 +1411,13 @@
 }
 
 std::pair<std::vector<WifiUsableChannel>, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal(
-        WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) {
+        WifiBand band, int32_t ifaceModeMask, int32_t filterMask) {
     legacy_hal::wifi_error legacy_status;
     std::vector<legacy_hal::wifi_usable_channel> legacy_usable_channels;
     std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels(
             aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band),
-            aidl_struct_util::convertAidlWifiIfaceModeToLegacy(
-                    static_cast<uint32_t>(ifaceModeMask)),
-            aidl_struct_util::convertAidlUsableChannelFilterToLegacy(
-                    static_cast<uint32_t>(filterMask)));
+            aidl_struct_util::convertAidlWifiIfaceModeToLegacy(ifaceModeMask),
+            aidl_struct_util::convertAidlUsableChannelFilterToLegacy(filterMask));
 
     if (legacy_status != legacy_hal::WIFI_SUCCESS) {
         return {std::vector<WifiUsableChannel>(), createWifiStatusFromLegacyError(legacy_status)};
@@ -1483,10 +1479,9 @@
 }
 
 ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetworkInternal(
-        ChannelCategoryMask channelCategoryEnableFlag) {
+        int32_t channelCategoryEnableFlag) {
     auto legacy_status = legacy_hal_.lock()->enableStaChannelForPeerNetwork(
-            aidl_struct_util::convertAidlChannelCategoryToLegacy(
-                    static_cast<uint32_t>(channelCategoryEnableFlag)));
+            aidl_struct_util::convertAidlChannelCategoryToLegacy(channelCategoryEnableFlag));
     return createWifiStatusFromLegacyError(legacy_status);
 }
 
diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h
index eca68ed..c5dcee7 100644
--- a/wifi/aidl/default/wifi_chip.h
+++ b/wifi/aidl/default/wifi_chip.h
@@ -85,7 +85,7 @@
     ndk::ScopedAStatus getId(int32_t* _aidl_return) override;
     ndk::ScopedAStatus registerEventCallback(
             const std::shared_ptr<IWifiChipEventCallback>& in_callback) override;
-    ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override;
+    ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
     ndk::ScopedAStatus getAvailableModes(std::vector<IWifiChip::ChipMode>* _aidl_return) override;
     ndk::ScopedAStatus configureChip(int32_t in_modeId) override;
     ndk::ScopedAStatus getMode(int32_t* _aidl_return) override;
@@ -136,10 +136,10 @@
     ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override;
     ndk::ScopedAStatus setCoexUnsafeChannels(
             const std::vector<IWifiChip::CoexUnsafeChannel>& in_unsafeChannels,
-            CoexRestriction in_restrictions) override;
+            int32_t in_restrictions) override;
     ndk::ScopedAStatus setCountryCode(const std::array<uint8_t, 2>& in_code) override;
-    ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask,
-                                         UsableChannelFilter in_filterMask,
+    ndk::ScopedAStatus getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask,
+                                         int32_t in_filterMask,
                                          std::vector<WifiUsableChannel>* _aidl_return) override;
     ndk::ScopedAStatus setAfcChannelAllowance(
             const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo) override;
@@ -148,7 +148,7 @@
             std::vector<WifiRadioCombination>* _aidl_return) override;
     ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override;
     ndk::ScopedAStatus enableStaChannelForPeerNetwork(
-            ChannelCategoryMask in_channelCategoryEnableFlag) override;
+            int32_t in_channelCategoryEnableFlag) override;
     binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
     ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override;
 
@@ -162,7 +162,7 @@
     std::pair<int32_t, ndk::ScopedAStatus> getIdInternal();
     ndk::ScopedAStatus registerEventCallbackInternal(
             const std::shared_ptr<IWifiChipEventCallback>& event_callback);
-    std::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> getCapabilitiesInternal();
+    std::pair<int32_t, ndk::ScopedAStatus> getCapabilitiesInternal();
     std::pair<std::vector<IWifiChip::ChipMode>, ndk::ScopedAStatus> getAvailableModesInternal();
     ndk::ScopedAStatus configureChipInternal(std::unique_lock<std::recursive_mutex>* lock,
                                              int32_t mode_id);
@@ -214,13 +214,11 @@
     ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname);
     ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case);
     ndk::ScopedAStatus setCoexUnsafeChannelsInternal(
-            std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels,
-            CoexRestriction restrictions);
+            std::vector<IWifiChip::CoexUnsafeChannel> unsafe_channels, int32_t restrictions);
     ndk::ScopedAStatus setCountryCodeInternal(const std::array<uint8_t, 2>& in_code);
     std::pair<std::vector<WifiUsableChannel>, ndk::ScopedAStatus> getUsableChannelsInternal(
-            WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask);
-    ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(
-            ChannelCategoryMask channelCategoryEnableFlag);
+            WifiBand band, int32_t ifaceModeMask, int32_t filterMask);
+    ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(int32_t channelCategoryEnableFlag);
     ndk::ScopedAStatus setAfcChannelAllowanceInternal(
             const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo);
     ndk::ScopedAStatus handleChipConfiguration(std::unique_lock<std::recursive_mutex>* lock,
diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp
index 300316a..eceeeb5 100644
--- a/wifi/aidl/default/wifi_sta_iface.cpp
+++ b/wifi/aidl/default/wifi_sta_iface.cpp
@@ -82,8 +82,7 @@
                            &WifiStaIface::registerEventCallbackInternal, in_callback);
 }
 
-ndk::ScopedAStatus WifiStaIface::getCapabilities(
-        IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) {
+ndk::ScopedAStatus WifiStaIface::getCapabilities(int32_t* _aidl_return) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
                            &WifiStaIface::getCapabilitiesInternal, _aidl_return);
 }
@@ -239,24 +238,20 @@
     return ndk::ScopedAStatus::ok();
 }
 
-std::pair<IWifiStaIface::StaIfaceCapabilityMask, ndk::ScopedAStatus>
-WifiStaIface::getCapabilitiesInternal() {
+std::pair<int32_t, ndk::ScopedAStatus> WifiStaIface::getCapabilitiesInternal() {
     legacy_hal::wifi_error legacy_status;
     uint64_t legacy_feature_set;
     std::tie(legacy_status, legacy_feature_set) =
             legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
     if (legacy_status != legacy_hal::WIFI_SUCCESS) {
-        return {IWifiStaIface::StaIfaceCapabilityMask{},
-                createWifiStatusFromLegacyError(legacy_status)};
+        return {0, createWifiStatusFromLegacyError(legacy_status)};
     }
     uint32_t aidl_caps;
     if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities(legacy_feature_set,
                                                                       &aidl_caps)) {
-        return {IWifiStaIface::StaIfaceCapabilityMask{},
-                createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
+        return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)};
     }
-    return {static_cast<IWifiStaIface::StaIfaceCapabilityMask>(aidl_caps),
-            ndk::ScopedAStatus::ok()};
+    return {aidl_caps, ndk::ScopedAStatus::ok()};
 }
 
 std::pair<StaApfPacketFilterCapabilities, ndk::ScopedAStatus>
diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h
index 2e4403a..0831e16 100644
--- a/wifi/aidl/default/wifi_sta_iface.h
+++ b/wifi/aidl/default/wifi_sta_iface.h
@@ -54,8 +54,7 @@
     ndk::ScopedAStatus getName(std::string* _aidl_return) override;
     ndk::ScopedAStatus registerEventCallback(
             const std::shared_ptr<IWifiStaIfaceEventCallback>& in_callback) override;
-    ndk::ScopedAStatus getCapabilities(
-            IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override;
+    ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
     ndk::ScopedAStatus getApfPacketFilterCapabilities(
             StaApfPacketFilterCapabilities* _aidl_return) override;
     ndk::ScopedAStatus installApfPacketFilter(const std::vector<uint8_t>& in_program) override;
@@ -99,7 +98,7 @@
     std::pair<std::string, ndk::ScopedAStatus> getNameInternal();
     ndk::ScopedAStatus registerEventCallbackInternal(
             const std::shared_ptr<IWifiStaIfaceEventCallback>& callback);
-    std::pair<IWifiStaIface::StaIfaceCapabilityMask, ndk::ScopedAStatus> getCapabilitiesInternal();
+    std::pair<int32_t, ndk::ScopedAStatus> getCapabilitiesInternal();
     std::pair<StaApfPacketFilterCapabilities, ndk::ScopedAStatus>
     getApfPacketFilterCapabilitiesInternal();
     ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector<uint8_t>& program);