From 86971aa04c233e9ea7969f0bf47e64d649ace391 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 3 Mar 2023 18:04:46 +0000 Subject: [PATCH] Convert NAN enums that are used as bitmaps to an int. Bug: 267819850 Test: atest VtsHalWifiNanIfaceTargetTest Change-Id: I6085c01fe6a7585fbdd8855bfdf183a75644ff80 --- .../android/hardware/wifi/NanCapabilities.aidl | 2 +- .../hardware/wifi/NanDiscoveryCommonConfig.aidl | 2 +- .../current/android/hardware/wifi/NanMatchInd.aidl | 2 +- .../aidl/android/hardware/wifi/NanCapabilities.aidl | 6 ++---- .../hardware/wifi/NanDiscoveryCommonConfig.aidl | 8 ++++---- wifi/aidl/android/hardware/wifi/NanMatchInd.aidl | 13 +++++++------ wifi/aidl/default/aidl_struct_util.cpp | 10 ++++------ 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index bb44679ade..a30893a0c2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -47,7 +47,7 @@ parcelable NanCapabilities { int maxAppInfoLen; int maxQueuedTransmitFollowupMsgs; int maxSubscribeInterfaceAddresses; - android.hardware.wifi.NanCipherSuiteType supportedCipherSuites; + int supportedCipherSuites; boolean instantCommunicationModeSupportFlag; boolean supports6g; boolean supportsHe; diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index e84cabfdf9..96d940ae31 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -51,7 +51,7 @@ parcelable NanDiscoveryCommonConfig { android.hardware.wifi.NanDataPathSecurityConfig securityConfig; boolean rangingRequired; int rangingIntervalMs; - android.hardware.wifi.NanRangingIndication configRangingIndications; + int configRangingIndications; char distanceIngressCm; char distanceEgressCm; boolean enableSessionSuspendability; diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl index 6757bec8ba..317489f223 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl @@ -47,7 +47,7 @@ parcelable NanMatchInd { boolean peerRequiresSecurityEnabledInNdp; boolean peerRequiresRanging; int rangingMeasurementInMm; - android.hardware.wifi.NanRangingIndication rangingIndicationType; + int rangingIndicationType; byte[] scid; android.hardware.wifi.NanPairingConfig peerPairingConfig; android.hardware.wifi.NanIdentityResolutionAttribute peerNira; diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index c1d6201299..f581c5e6cf 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -16,8 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanCipherSuiteType; - /** * NDP Capabilities response. */ @@ -78,9 +76,9 @@ parcelable NanCapabilities { */ int maxSubscribeInterfaceAddresses; /** - * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used. + * Bitmap of |NanCipherSuiteType| values indicating the set of supported cipher suites. */ - NanCipherSuiteType supportedCipherSuites; + int supportedCipherSuites; /** * Flag to indicate if instant communication mode is supported. */ diff --git a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index e98658b012..58777c5d65 100644 --- a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -18,7 +18,6 @@ package android.hardware.wifi; import android.hardware.wifi.NanDataPathSecurityConfig; import android.hardware.wifi.NanMatchAlg; -import android.hardware.wifi.NanRangingIndication; /** * Configurations of NAN discovery sessions. Common to publish and subscribe discovery. @@ -143,10 +142,11 @@ parcelable NanDiscoveryCommonConfig { */ int rangingIntervalMs; /** - * The type of ranging feedback to be provided by discovery session matches - * |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true. + * Bitmap of |NanRangingIndication| values indicating the type of ranging feedback + * to be provided by discovery session matches in |IWifiNanIfaceEventCallback.eventMatch|. + * Only relevant if |rangingRequired| is true. */ - NanRangingIndication configRangingIndications; + int configRangingIndications; /** * The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then * |configRangingIndications| is used to determine whether ingress and/or egress (or neither) diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl index 314d59922a..5a04376c75 100644 --- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl @@ -19,7 +19,6 @@ package android.hardware.wifi; import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanIdentityResolutionAttribute; import android.hardware.wifi.NanPairingConfig; -import android.hardware.wifi.NanRangingIndication; /** * Match indication structure. @@ -81,8 +80,9 @@ parcelable NanMatchInd { */ byte rssiValue; /** - * Cipher type for data-paths constructed in the context of this discovery session. Valid if - * |peerRequiresSecurityEnabledInNdp| is true. + * One of |NanCipherSuiteType| indicating the cipher type for data-paths constructed + * in the context of this discovery session. + * Valid if |peerRequiresSecurityEnabledInNdp| is true. */ NanCipherSuiteType peerCipherType; /** @@ -117,10 +117,11 @@ parcelable NanMatchInd { */ int rangingMeasurementInMm; /** - * The ranging event(s) which triggered the ranging. e.g. can indicate that continuous ranging - * was requested, or else that an ingress event occurred. + * Bitmap of |NanRangingIndication| values indicating the ranging event(s) which triggered the + * ranging. e.g. can indicate that continuous ranging was requested, or else that an ingress + * event occurred. */ - NanRangingIndication rangingIndicationType; + int rangingIndicationType; /** * Security Context Identifier attribute contains PMKID. Shall be included in NDP setup and * response messages. Security Context Identifier identifies the Security Context. For NAN diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5bfdcbb408..fc90d7e543 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1787,7 +1787,7 @@ bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, : legacy_hal::NAN_RANGING_DISABLE; legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); + aidl_request.baseConfigs.configRangingIndications; legacy_request->ranging_cfg.distance_ingress_mm = aidl_request.baseConfigs.distanceIngressCm * 10; legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; @@ -1919,7 +1919,7 @@ bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_requ : legacy_hal::NAN_RANGING_DISABLE; legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); + aidl_request.baseConfigs.configRangingIndications; legacy_request->ranging_cfg.distance_ingress_mm = aidl_request.baseConfigs.distanceIngressCm * 10; legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; @@ -2202,8 +2202,7 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->maxQueuedTransmitFollowupMsgs = legacy_response.max_queued_transmit_followup_msgs; aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - aidl_response->supportedCipherSuites = - static_cast(legacy_response.cipher_suites_supported); + aidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; aidl_response->supports6g = legacy_response.is_6g_supported; aidl_response->supportsHe = legacy_response.is_he_supported; @@ -2244,8 +2243,7 @@ bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, aidl_ind->peerRequiresRanging = legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; - aidl_ind->rangingIndicationType = - static_cast(legacy_ind.range_info.ranging_event_type); + aidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); if (!convertLegacyNiraToAidl(legacy_ind.nira, &aidl_ind->peerNira)) {