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

Commit ccf7517d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "wifi: add enable SAE PK only mode API"

parents 734be98c 7e792611
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ cc_test {
        "android.hardware.wifi.supplicant@1.1",
        "android.hardware.wifi.supplicant@1.2",
        "android.hardware.wifi.supplicant@1.3",
        "android.hardware.wifi.supplicant@1.4",
        "android.hardware.wifi@1.0",
        "android.hardware.wifi@1.1",
        "libgmock",
+31 −6
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaIfaceCallback.h>
#include <android/hardware/wifi/supplicant/1.3/ISupplicantStaNetwork.h>
#include <android/hardware/wifi/supplicant/1.3/types.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
#include <android/hardware/wifi/supplicant/1.4/types.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/HidlSupport.h>
@@ -61,6 +63,10 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_3 {
        SupplicantHidlTestBaseV1_3::SetUp();
        sta_iface_ = getSupplicantStaIface_1_3(supplicant_);
        ASSERT_NE(sta_iface_.get(), nullptr);

        /* Variable used to check the underlying HAL version. */
        sta_iface_v1_4_ = ::android::hardware::wifi::supplicant::V1_4::
            ISupplicantStaIface::castFrom(sta_iface_);
    }

    int64_t pmkCacheExpirationTimeInSec;
@@ -108,6 +114,8 @@ class SupplicantStaIfaceHidlTest : public SupplicantHidlTestBaseV1_3 {
   protected:
    // ISupplicantStaIface object used for all tests in this fixture.
    sp<ISupplicantStaIface> sta_iface_;
    sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface>
        sta_iface_v1_4_ = nullptr;

    bool isDppSupported() {
        uint32_t keyMgmtMask = 0;
@@ -342,9 +350,12 @@ TEST_P(SupplicantStaIfaceHidlTest, GetConnectionCapabilities) {
 * GetWpaDriverCapabilities
 */
TEST_P(SupplicantStaIfaceHidlTest, GetWpaDriverCapabilities) {
    SupplicantStatusCode expectedCode =
        (nullptr != sta_iface_v1_4_) ? SupplicantStatusCode::FAILURE_UNKNOWN
                                     : SupplicantStatusCode::SUCCESS;
    sta_iface_->getWpaDriverCapabilities(
        [&](const SupplicantStatus& status, uint32_t) {
            EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
            EXPECT_EQ(expectedCode, status.code);
        });
}

@@ -355,12 +366,26 @@ TEST_P(SupplicantStaIfaceHidlTest, SetMboCellularDataStatus) {
    uint32_t driverCapMask = 0;

    // Get MBO support from the device.
    if (nullptr != sta_iface_v1_4_) {
        sta_iface_v1_4_->getWpaDriverCapabilities_1_4(
            [&](const ::android::hardware::wifi::supplicant::V1_4::
                    SupplicantStatus& status,
                uint32_t driverCapMaskInternal) {
                EXPECT_EQ(::android::hardware::wifi::supplicant::V1_4::
                              SupplicantStatusCode::SUCCESS,
                          status.code);

                driverCapMask = driverCapMaskInternal;
            });
    } else {
        sta_iface_->getWpaDriverCapabilities(
        [&](const SupplicantStatus& status, uint32_t driverCapMaskInternal) {
            [&](const SupplicantStatus& status,
                uint32_t driverCapMaskInternal) {
                EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);

                driverCapMask = driverCapMaskInternal;
            });
    }

    SupplicantStatusCode expectedStatusCode =
        (driverCapMask & WpaDriverCapabilitiesMask::MBO)
+11 −0
Original line number Diff line number Diff line
@@ -73,4 +73,15 @@ interface ISupplicantStaIface extends @1.3::ISupplicantStaIface {
     */
    initiateVenueUrlAnqpQuery(MacAddress macAddress)
        generates (SupplicantStatus status);

    /**
     * Get wpa driver capabilities.
     *
     * @return status Status of the operation, and a bitmap of wpa driver features.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     */
    getWpaDriverCapabilities_1_4() generates (SupplicantStatus status,
        bitfield<WpaDriverCapabilitiesMask> driverCapabilitiesMask);
};
+28 −0
Original line number Diff line number Diff line
@@ -24,6 +24,16 @@ import @1.4::ISupplicantStaNetworkCallback;
 * configuration it controls.
 */
interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
    /**
     * Possible mask of values for KeyMgmt param.
     */
    enum KeyMgmtMask : @1.3::ISupplicantStaNetwork.KeyMgmtMask {
        /**
         * SAE PK mode
         */
        SAE_PK,
    };

    /**
     * Possible mask of values for PairwiseCipher param.
     */
@@ -160,4 +170,22 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
     */
    enableSaeH2eOnlyMode(bool enable) generates (SupplicantStatus status);

    /**
     * Set whether to enable SAE PK (Public Key) only mode to enable public AP validation.
     * When enabled, only SAE PK network is allowed; otherwise PK is optional.
     * If this API is not called before connecting to an SAE
     * network, SAE PK mode depends on SAE PK config in wpa_supplicant configuration.
     * If SAE PK config of wpa_supplicant configuration is not set,
     * the default mode is optional (support for both PK and standard mode).
     *
     * @param enable true to set, false otherwise.
     * @return status Status of the operation.
     *         Possible status codes:
     *         |SupplicantStatusCode.SUCCESS|,
     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
     *         |SupplicantStatusCode.FAILURE_UNSUPPORTED|
     */
    enableSaePkOnlyMode(bool enable) generates (SupplicantStatus status);
};
+11 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.wifi.supplicant@1.4;

import @1.0::SupplicantStatusCode;
import @1.3::ConnectionCapabilities;
import @1.3::WpaDriverCapabilitiesMask;

/**
 * Detailed network mode for legacy network
@@ -71,3 +72,13 @@ struct SupplicantStatus {
   */
  string debugMessage;
};

/**
 * WPA Driver capability.
 */
enum WpaDriverCapabilitiesMask : @1.3::WpaDriverCapabilitiesMask {
    /**
     *
     */
    SAE_PK = 1 << 2,
};
Loading