wifi: add transition disable callback API

Bug: 160643860
Test: atest VtsHalWifiSupplicantV1_4TargetTest
Change-Id: I66839d6766b39483c78919aaa42d42db032f87a7
This commit is contained in:
Jimmy Chen
2020-10-14 23:46:36 +08:00
parent c146f8615b
commit 77f2c0780c
5 changed files with 169 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ hidl_interface {
"ISupplicantP2pIface.hal",
"ISupplicantStaIface.hal",
"ISupplicantStaNetwork.hal",
"ISupplicantStaNetworkCallback.hal",
],
interfaces: [
"android.hardware.wifi.supplicant@1.0",

View File

@@ -17,6 +17,7 @@
package android.hardware.wifi.supplicant@1.4;
import @1.3::ISupplicantStaNetwork;
import @1.4::ISupplicantStaNetworkCallback;
import @1.0::SupplicantStatus;
/**
@@ -123,4 +124,23 @@ interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
* @return enabled true if set, false otherwise.
*/
getEdmg() generates (SupplicantStatus status, bool enabled);
/**
* Register for callbacks from this network.
*
* These callbacks are invoked for events that are specific to this network.
* Registration of multiple callback objects is supported. These objects must
* be automatically deleted when the corresponding client process is dead or
* if this network is removed.
*
* @param callback An instance of the |ISupplicantStaNetworkCallback| HIDL
* interface object.
* @return status Status of the operation.
* Possible status codes:
* |SupplicantStatusCode.SUCCESS|,
* |SupplicantStatusCode.FAILURE_UNKNOWN|,
* |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
*/
registerCallback_1_4(ISupplicantStaNetworkCallback callback)
generates (SupplicantStatus status);
};

View File

@@ -0,0 +1,46 @@
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.wifi.supplicant@1.4;
import @1.0::ISupplicantStaNetworkCallback;
/**
* Callback Interface exposed by the supplicant service
* for each network (ISupplicantStaNetwork).
*
* Clients need to host an instance of this HIDL interface object and
* pass a reference of the object to the supplicant via the
* corresponding |ISupplicantStaNetwork.registerCallback_1_4| method.
*/
interface ISupplicantStaNetworkCallback extends @1.0::ISupplicantStaNetworkCallback {
/**
* WPA3™ Specification Addendum for WPA3 R3 - Table 3.
* Transition Disable Indication filled in the third
* 4-way handshake message.
*/
enum TransitionDisableIndication : uint32_t {
USE_WPA3_PERSONAL = 1 << 0,
USE_SAE_PK = 1 << 1,
USE_WPA3_ENTERPRISE = 1 << 2,
USE_ENHANCED_OPEN = 1 << 3,
};
/**
* Used to notify WPA3 transition disable.
*/
oneway onTransitionDisable(bitfield<TransitionDisableIndication> ind);
};

View File

@@ -44,6 +44,7 @@ cc_test {
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
"supplicant_sta_iface_hidl_test.cpp",
"supplicant_sta_network_hidl_test.cpp",
],
static_libs: [
"VtsHalWifiV1_0TargetTestUtil",

View File

@@ -0,0 +1,101 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <android-base/logging.h>
#include <VtsCoreUtil.h>
#include <android/hardware/wifi/1.0/IWifi.h>
#include <android/hardware/wifi/supplicant/1.0/ISupplicantStaNetwork.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaNetwork.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <hidl/ServiceManagement.h>
#include "supplicant_hidl_test_utils.h"
#include "supplicant_hidl_test_utils_1_4.h"
using ::android::sp;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::wifi::supplicant::V1_0::IfaceType;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicant;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaIface;
using ::android::hardware::wifi::supplicant::V1_0::ISupplicantStaNetwork;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus;
using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode;
using ::android::hardware::wifi::supplicant::V1_4::
ISupplicantStaNetworkCallback;
using ::android::hardware::wifi::V1_0::IWifi;
class SupplicantStaNetworkHidlTest : public SupplicantHidlTestBaseV1_4 {
public:
virtual void SetUp() override {
SupplicantHidlTestBaseV1_4::SetUp();
sta_network_ = createSupplicantStaNetwork(supplicant_);
ASSERT_NE(sta_network_.get(), nullptr);
/* variable used to check if the underlying HAL version is 1.4 or
* higher. This is to skip tests which are using deprecated methods.
*/
v1_4 = ::android::hardware::wifi::supplicant::V1_4::
ISupplicantStaNetwork::castFrom(sta_network_);
}
protected:
sp<::android::hardware::wifi::supplicant::V1_4::ISupplicantStaNetwork>
v1_4 = nullptr;
// ISupplicantStaNetwork object used for all tests in this fixture.
sp<ISupplicantStaNetwork> sta_network_;
};
class NetworkCallback : public ISupplicantStaNetworkCallback {
Return<void> onNetworkEapSimGsmAuthRequest(
const ISupplicantStaNetworkCallback::NetworkRequestEapSimGsmAuthParams&
/* params */) override {
return Void();
}
Return<void> onNetworkEapSimUmtsAuthRequest(
const ISupplicantStaNetworkCallback::NetworkRequestEapSimUmtsAuthParams&
/* params */) override {
return Void();
}
Return<void> onNetworkEapIdentityRequest() override { return Void(); }
Return<void> onTransitionDisable(uint32_t /* params */) override {
return Void();
}
};
/*
* RegisterCallback
*/
TEST_P(SupplicantStaNetworkHidlTest, RegisterCallback_1_4) {
v1_4->registerCallback_1_4(
new NetworkCallback(), [](const SupplicantStatus& status) {
EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code);
});
}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkHidlTest);
INSTANTIATE_TEST_CASE_P(
PerInstance, SupplicantStaNetworkHidlTest,
testing::Combine(
testing::ValuesIn(
android::hardware::getAllHalInstanceNames(IWifi::descriptor)),
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
ISupplicant::descriptor))),
android::hardware::PrintInstanceTupleNameToString<>);