Use an int to represent bitmaps in

the Vendor HAL AIDL interface.

Bug: 267819850
Test: atest VtsHalWifiChipTargetTest \
            VtsHalWifiStaIfaceTargetTest \
	    VtsHalWifiApIfaceTargetTest \
	    VtsHalWifiNanIfaceTargetTest \
	    VtsHalWifiRttControllerTargetTest
Change-Id: Ic72496c654067b2db97109cc3dc9ff50f1f1d1dd
This commit is contained in:
Gabriel Biren 2023-02-04 00:26:46 +00:00
parent 95342882f2
commit 008c1da031
13 changed files with 32 additions and 37 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

@ -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);
}
/*