Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a58bf74 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11479893 from be8a9382 to 24Q2-release

Change-Id: I3d9f329ab6b7b64d650740cc589f3ff5081f2716
parents a465765a be8a9382
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -62,6 +62,23 @@ bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr<IWifiCh
    int mode_id;
    return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, &mode_id);
}

OuiKeyedData generateOuiKeyedData(int oui) {
    PersistableBundle bundle;
    bundle.putString("stringKey", "stringValue");
    bundle.putInt("intKey", 12345);

    OuiKeyedData data;
    data.oui = oui;
    data.vendorData = bundle;
    return data;
}

// Wraps generateOuiKeyedData result in std::optional
std::optional<OuiKeyedData> generateOuiKeyedDataOptional(int oui) {
    return std::optional<OuiKeyedData>{generateOuiKeyedData(oui)};
}

}  // namespace

bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code) {
@@ -238,3 +255,20 @@ int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip) {
bool isAidlServiceAvailable(const char* instance_name) {
    return AServiceManager_isDeclared(instance_name);
}

std::vector<OuiKeyedData> generateOuiKeyedDataList(int size) {
    std::vector<OuiKeyedData> dataList;
    for (int i = 0; i < size; i++) {
        dataList.push_back(generateOuiKeyedData(i + 1));
    }
    return dataList;
}

// Generate OuiKeyedData list fully wrapped in std::optional
std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataListOptional(int size) {
    std::vector<std::optional<OuiKeyedData>> dataList;
    for (int i = 0; i < size; i++) {
        dataList.push_back(generateOuiKeyedDataOptional(i + 1));
    }
    return std::optional<std::vector<std::optional<OuiKeyedData>>>{dataList};
}
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <aidl/android/hardware/wifi/IWifi.h>
#include <aidl/android/hardware/wifi/IWifiChip.h>
#include <android/binder_manager.h>
#include <android/persistable_bundle_aidl.h>
#include <wifi_system/interface_tool.h>

using aidl::android::hardware::wifi::IfaceConcurrencyType;
@@ -30,6 +31,8 @@ using aidl::android::hardware::wifi::IWifiChip;
using aidl::android::hardware::wifi::IWifiNanIface;
using aidl::android::hardware::wifi::IWifiStaIface;
using aidl::android::hardware::wifi::WifiStatusCode;
using aidl::android::hardware::wifi::common::OuiKeyedData;
using aidl::android::os::PersistableBundle;

// Helper functions to obtain references to the various AIDL interface objects.
std::shared_ptr<IWifi> getWifi(const char* instance_name);
@@ -50,3 +53,6 @@ void stopWifiService(const char* instance_name);
int32_t getChipFeatureSet(const std::shared_ptr<IWifiChip>& wifi_chip);
bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code);
bool isAidlServiceAvailable(const char* instance_name);
// Generate test vendor data.
std::vector<OuiKeyedData> generateOuiKeyedDataList(int size);
std::optional<std::vector<std::optional<OuiKeyedData>>> generateOuiKeyedDataListOptional(int size);
+11 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiNanIfaceEventCallback.h>
#include <aidl/android/hardware/wifi/NanBandIndex.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -60,6 +61,10 @@ using aidl::android::hardware::wifi::NanTxType;

#define TIMEOUT_PERIOD 10

namespace {
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);
}

class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {
  public:
    void SetUp() override {
@@ -72,6 +77,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {
        std::shared_ptr<WifiNanIfaceEventCallback> callback =
                ndk::SharedRefBase::make<WifiNanIfaceEventCallback>(*this);
        EXPECT_TRUE(wifi_nan_iface_->registerEventCallback(callback).isOk());
        EXPECT_TRUE(wifi_nan_iface_->getInterfaceVersion(&interface_version_).isOk());
    }

    void TearDown() override { stopWifiService(getInstanceName()); }
@@ -401,6 +407,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam<std::string> {

  protected:
    std::shared_ptr<IWifiNanIface> wifi_nan_iface_;
    int interface_version_;
    uint64_t callback_event_bitmap_;
    uint16_t id_;
    uint8_t session_id_;
@@ -640,6 +647,10 @@ TEST_P(WifiNanIfaceAidlTest, StartPublishRequest) {
    nanPublishRequest.autoAcceptDataPathRequests = false;
    nanPublishRequest.publishType = NanPublishType::UNSOLICITED;
    nanPublishRequest.txType = NanTxType::BROADCAST;
    if (interface_version_ >= 2) {
        LOG(INFO) << "Including vendor data in Publish request";
        nanPublishRequest.vendorData = kTestVendorDataOptional;
    }

    status = wifi_nan_iface_->startPublishRequest(inputCmdId + 1, nanPublishRequest);
    if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) {
+11 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/wifi/BnWifi.h>
#include <aidl/android/hardware/wifi/BnWifiRttControllerEventCallback.h>
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -42,6 +43,10 @@ using aidl::android::hardware::wifi::WifiChannelInfo;
using aidl::android::hardware::wifi::WifiChannelWidthInMhz;
using aidl::android::hardware::wifi::WifiStatusCode;

namespace {
const auto& kTestVendorDataOptional = generateOuiKeyedDataListOptional(5);
}

class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
  public:
    void SetUp() override {
@@ -50,6 +55,7 @@ class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
        stopWifiService(getInstanceName());
        wifi_rtt_controller_ = getWifiRttController();
        ASSERT_NE(nullptr, wifi_rtt_controller_.get());
        ASSERT_TRUE(wifi_rtt_controller_->getInterfaceVersion(&interface_version_).isOk());

        // Check RTT support before we run the test.
        RttCapabilities caps = {};
@@ -82,6 +88,7 @@ class WifiRttControllerAidlTest : public testing::TestWithParam<std::string> {
    }

    std::shared_ptr<IWifiRttController> wifi_rtt_controller_;
    int interface_version_;

  private:
    const char* getInstanceName() { return GetParam().c_str(); }
@@ -226,6 +233,10 @@ TEST_P(WifiRttControllerAidlTest, RangeRequest) {
    config.numRetriesPerRttFrame = 3;
    config.numRetriesPerFtmr = 3;
    config.burstDuration = 9;
    if (interface_version_ >= 2) {
        LOG(INFO) << "Including vendor data in Rtt Config";
        config.vendorData = kTestVendorDataOptional;
    }

    int cmdId = 55;
    std::vector<RttConfig> configs = {config};
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ cc_test {
        "libvndksupport",
    ],
    static_libs: [
        "android.hardware.wifi.hostapd-V1-ndk",
        "android.hardware.wifi.hostapd-V2-ndk",
        "VtsHalWifiV1_0TargetTestUtil",
        "VtsHalWifiV1_5TargetTestUtil",
        "VtsHalWifiV1_6TargetTestUtil",
Loading