Merge changes from topic "vendor-hal-bitmaps" into udc-dev

* changes:
  Update Vendor HAL service to use ints for bitmaps instead of using enums.
  Use an int to represent bitmaps in the Vendor HAL AIDL interface.
This commit is contained in:
Gabriel Biren 2023-03-03 21:21:34 +00:00 committed by Android (Google) Code Review
commit 53368fa332
19 changed files with 70 additions and 85 deletions

View file

@ -47,7 +47,7 @@ interface IWifiChip {
@PropagateAllowBlocking android.hardware.wifi.IWifiApIface getApIface(in String ifname);
String[] getApIfaceNames();
android.hardware.wifi.IWifiChip.ChipMode[] getAvailableModes();
android.hardware.wifi.IWifiChip.ChipCapabilityMask getCapabilities();
int getCapabilities();
android.hardware.wifi.WifiDebugHostWakeReasonStats getDebugHostWakeReasonStats();
android.hardware.wifi.WifiDebugRingBufferStatus[] getDebugRingBuffersStatus();
int getId();
@ -60,7 +60,7 @@ interface IWifiChip {
String[] getStaIfaceNames();
android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations();
android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities();
android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask);
android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in int ifaceModeMask, in int filterMask);
void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo);
void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback);
void removeApIface(in String ifname);
@ -73,7 +73,7 @@ interface IWifiChip {
byte[] requestFirmwareDebugDump();
void resetTxPowerScenario();
void selectTxPowerScenario(in android.hardware.wifi.IWifiChip.TxPowerScenario scenario);
void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in android.hardware.wifi.IWifiChip.CoexRestriction restrictions);
void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in int restrictions);
void setCountryCode(in byte[2] code);
void setLatencyMode(in android.hardware.wifi.IWifiChip.LatencyMode mode);
void setMultiStaPrimaryConnection(in String ifName);
@ -81,7 +81,7 @@ interface IWifiChip {
void startLoggingToDebugRingBuffer(in String ringName, in android.hardware.wifi.WifiDebugRingBufferVerboseLevel verboseLevel, in int maxIntervalInSec, in int minDataSizeInBytes);
void stopLoggingToDebugRingBuffer();
void triggerSubsystemRestart();
void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag);
void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag);
void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode);
const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF;
@Backing(type="int") @VintfStability

View file

@ -41,7 +41,7 @@ interface IWifiStaIface {
void enableNdOffload(in boolean enable);
android.hardware.wifi.StaApfPacketFilterCapabilities getApfPacketFilterCapabilities();
android.hardware.wifi.StaBackgroundScanCapabilities getBackgroundScanCapabilities();
android.hardware.wifi.IWifiStaIface.StaIfaceCapabilityMask getCapabilities();
int getCapabilities();
android.hardware.wifi.WifiDebugRxPacketFateReport[] getDebugRxPacketFates();
android.hardware.wifi.WifiDebugTxPacketFateReport[] getDebugTxPacketFates();
byte[6] getFactoryMacAddress();

View file

@ -38,7 +38,7 @@ parcelable StaBackgroundScanBucketParameters {
android.hardware.wifi.WifiBand band;
int[] frequencies;
int periodInMs;
android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask eventReportScheme;
int eventReportScheme;
int exponentialMaxPeriodInMs;
int exponentialBase;
int exponentialStepCount;

View file

@ -34,7 +34,7 @@
package android.hardware.wifi;
@VintfStability
parcelable StaScanData {
android.hardware.wifi.StaScanDataFlagMask flags;
int flags;
int bucketsScanned;
android.hardware.wifi.StaScanResult[] results;
}

View file

@ -36,5 +36,5 @@ package android.hardware.wifi;
parcelable WifiUsableChannel {
int channel;
android.hardware.wifi.WifiChannelWidthInMhz channelBandwidth;
android.hardware.wifi.WifiIfaceMode ifaceModeMask;
int ifaceModeMask;
}

View file

@ -590,7 +590,7 @@ interface IWifiChip {
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
ChipCapabilityMask getCapabilities();
int getCapabilities();
/**
* API to retrieve the wifi wake up reason stats for debugging.
@ -808,7 +808,7 @@ interface IWifiChip {
* |WifiStatusCode.FAILURE_UNKNOWN|
*/
WifiUsableChannel[] getUsableChannels(
in WifiBand band, in WifiIfaceMode ifaceModeMask, in UsableChannelFilter filterMask);
in WifiBand band, in int ifaceModeMask, in int filterMask);
/*
* Set the max power level the chip is allowed to transmit on for 6Ghz AFC
@ -982,8 +982,7 @@ interface IWifiChip {
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
*/
void setCoexUnsafeChannels(
in CoexUnsafeChannel[] unsafeChannels, in CoexRestriction restrictions);
void setCoexUnsafeChannels(in CoexUnsafeChannel[] unsafeChannels, in int restrictions);
/**
* Set country code for this Wifi chip.
@ -1110,14 +1109,14 @@ interface IWifiChip {
* If the channel category is enabled and allowed by the regulatory, the HAL method
* getUsableChannels() will contain the current STA-connected channel if that channel belongs
* to that category.
* @param channelCategoryEnableFlag bitmask of |ChannelCategoryMask|.
* @param channelCategoryEnableFlag Bitmask of |ChannelCategoryMask| values.
* For each bit, 1 enables the channel category and 0 disables that channel category.
* @throws ServiceSpecificException with one of the following values:
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.FAILURE_UNKNOWN|
*/
void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag);
void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag);
/**
* Multi-Link Operation modes.

View file

@ -198,7 +198,7 @@ interface IWifiStaIface {
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
StaIfaceCapabilityMask getCapabilities();
int getCapabilities();
/**
* API to retrieve the fates of inbound packets.

View file

@ -16,7 +16,6 @@
package android.hardware.wifi;
import android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask;
import android.hardware.wifi.WifiBand;
/**
@ -50,7 +49,7 @@ parcelable StaBackgroundScanBucketParameters {
* Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling
* when events for this bucket must be reported.
*/
StaBackgroundScanBucketEventReportSchemeMask eventReportScheme;
int eventReportScheme;
/**
* For exponential back off. If |exponentialMaxPeriodInMs| is non-zero or
* different than period, then this bucket is an exponential backoff bucket

View file

@ -16,7 +16,6 @@
package android.hardware.wifi;
import android.hardware.wifi.StaScanDataFlagMask;
import android.hardware.wifi.StaScanResult;
/**
@ -26,9 +25,9 @@ import android.hardware.wifi.StaScanResult;
@VintfStability
parcelable StaScanData {
/**
* Bitset containing |ScanDataFlagMask| values.
* Bitset of |ScanDataFlagMask| values.
*/
StaScanDataFlagMask flags;
int flags;
/**
* Bitset where each bit indicates if the bucket with that index (starting at
* 0) was scanned.

View file

@ -17,7 +17,6 @@
package android.hardware.wifi;
import android.hardware.wifi.WifiChannelWidthInMhz;
import android.hardware.wifi.WifiIfaceMode;
/**
* Wifi usable channel information.
@ -33,7 +32,8 @@ parcelable WifiUsableChannel {
*/
WifiChannelWidthInMhz channelBandwidth;
/**
* Iface modes feasible on this channel.
* Iface modes feasible on this channel, represented as a bitmask
* of |WifiIfaceMode| values.
*/
WifiIfaceMode ifaceModeMask;
int ifaceModeMask;
}

View file

@ -408,8 +408,8 @@ bool convertLegacyWifiUsableChannelToAidl(
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 @@ bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan
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 @@ bool convertLegacyCachedGscanResultsToAidl(
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 &&

View file

@ -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>

View file

@ -455,7 +455,7 @@ ndk::ScopedAStatus WifiChip::registerEventCallback(
&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::setMultiStaUseCase(IWifiChip::MultiStaUseCase in_us
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 @@ ndk::ScopedAStatus WifiChip::setCountryCode(const std::array<uint8_t, 2>& in_cod
&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 @@ ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl
&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 @@ ndk::ScopedAStatus WifiChip::registerEventCallbackInternal(
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::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> WifiChip::getCapabi
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 @@ std::pair<IWifiChip::ChipCapabilityMask, ndk::ScopedAStatus> WifiChip::getCapabi
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::setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCa
}
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 @@ ndk::ScopedAStatus WifiChip::setCountryCodeInternal(const std::array<uint8_t, 2>
}
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 @@ std::pair<WifiChipCapabilities, ndk::ScopedAStatus> WifiChip::getWifiChipCapabil
}
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);
}

View file

@ -85,7 +85,7 @@ class WifiChip : public BnWifiChip {
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 @@ class WifiChip : public BnWifiChip {
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 @@ class WifiChip : public BnWifiChip {
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 @@ class WifiChip : public BnWifiChip {
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 @@ class WifiChip : public BnWifiChip {
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,

View file

@ -82,8 +82,7 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallback(
&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 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal(
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>

View file

@ -54,8 +54,7 @@ class WifiStaIface : public BnWifiStaIface {
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 @@ class WifiStaIface : public BnWifiStaIface {
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);

View file

@ -208,9 +208,9 @@ void stopWifiService(const char* instance_name) {
}
int32_t getChipCapabilities(const std::shared_ptr<IWifiChip>& wifi_chip) {
IWifiChip::ChipCapabilityMask caps = {};
int32_t caps = 0;
if (wifi_chip->getCapabilities(&caps).isOk()) {
return static_cast<int32_t>(caps);
return caps;
}
return 0;
}

View file

@ -22,6 +22,7 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiChipEventCallback.h>
#include <aidl/android/hardware/wifi/WifiIfaceMode.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@ -232,9 +233,7 @@ TEST_P(WifiChipAidlTest, GetUsableChannels) {
std::vector<WifiUsableChannel> channels;
configureChipForConcurrencyType(IfaceConcurrencyType::STA);
auto status = wifi_chip_->getUsableChannels(
band, static_cast<WifiIfaceMode>(ifaceModeMask),
static_cast<IWifiChip::UsableChannelFilter>(filterMask), &channels);
auto status = wifi_chip_->getUsableChannels(band, ifaceModeMask, filterMask, &channels);
if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) {
GTEST_SKIP() << "getUsableChannels() is not supported by vendor.";
}
@ -337,7 +336,7 @@ TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) {
// Test with an empty vector of CoexUnsafeChannels.
std::vector<IWifiChip::CoexUnsafeChannel> vec;
IWifiChip::CoexRestriction restrictions = static_cast<IWifiChip::CoexRestriction>(0);
int restrictions = 0;
auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions);
if (!status.isOk()) {
EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED));
@ -352,10 +351,9 @@ TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) {
unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ;
unsafeChannel5Ghz.channel = 36;
vec.push_back(unsafeChannel5Ghz);
restrictions = static_cast<IWifiChip::CoexRestriction>(
static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_AWARE) |
static_cast<int32_t>(IWifiChip::CoexRestriction::SOFTAP) |
static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_DIRECT));
restrictions = static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_AWARE) |
static_cast<int32_t>(IWifiChip::CoexRestriction::SOFTAP) |
static_cast<int32_t>(IWifiChip::CoexRestriction::WIFI_DIRECT);
status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions);
if (!status.isOk()) {

View file

@ -54,9 +54,9 @@ class WifiStaIfaceAidlTest : public testing::TestWithParam<std::string> {
protected:
bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) {
IWifiStaIface::StaIfaceCapabilityMask caps = {};
int32_t caps = 0;
EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk());
return static_cast<uint32_t>(caps) & static_cast<uint32_t>(expected);
return caps & static_cast<int32_t>(expected);
}
ndk::ScopedAStatus createStaIface(std::shared_ptr<IWifiStaIface>* sta_iface) {
@ -86,9 +86,9 @@ TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) {
* GetCapabilities
*/
TEST_P(WifiStaIfaceAidlTest, GetCapabilities) {
IWifiStaIface::StaIfaceCapabilityMask caps = {};
int32_t caps = 0;
EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk());
EXPECT_NE(static_cast<int32_t>(caps), 0);
EXPECT_NE(caps, 0);
}
/*