diff --git a/current.txt b/current.txt index 594ceb632c..b929f7ddd3 100644 --- a/current.txt +++ b/current.txt @@ -777,3 +777,6 @@ cd84ab19c590e0e73dd2307b591a3093ee18147ef95e6d5418644463a6620076 android.hardwar # HALs released in Android S # NOTE: waiting to freeze HALs until later in the release # NOTE: new HALs are recommended to be in AIDL +57d183b10b13ec0a8e542c0b3d61991ae541c60e85dbbc5499bb21dfd068cbb8 android.hardware.wifi.supplicant@1.4::types +17818b6b1952a75e4364ae82c534b9d2f5c0a9765a56256b16faa5a5cf45d3a8 android.hardware.wifi.supplicant@1.4::ISupplicant +8342b5f6ec8f48ad2b741128aede010995d0b5709257b7ec09bb469b4f61ef1a android.hardware.wifi.supplicant@1.4::ISupplicantStaIface diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp index 011a955983..9b7b45db8c 100644 --- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp +++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -353,7 +353,11 @@ TEST_P(SupplicantStaIfaceHidlTest, GetConnectionCapabilities) { sta_iface_->getConnectionCapabilities( [&](const SupplicantStatus& status, ConnectionCapabilities /* capabilities */) { - EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + // Since getConnectionCapabilities() is overridden by an + // upgraded API in newer HAL versions, allow for FAILURE_UNKNOWN + if (status.code != SupplicantStatusCode::FAILURE_UNKNOWN) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + } }); } diff --git a/wifi/supplicant/1.4/Android.bp b/wifi/supplicant/1.4/Android.bp index ff2a8bc665..81e17387f1 100644 --- a/wifi/supplicant/1.4/Android.bp +++ b/wifi/supplicant/1.4/Android.bp @@ -4,7 +4,9 @@ hidl_interface { name: "android.hardware.wifi.supplicant@1.4", root: "android.hardware", srcs: [ + "types.hal", "ISupplicant.hal", + "ISupplicantStaIface.hal", ], interfaces: [ "android.hardware.wifi.supplicant@1.0", diff --git a/wifi/supplicant/1.4/ISupplicantStaIface.hal b/wifi/supplicant/1.4/ISupplicantStaIface.hal new file mode 100644 index 0000000000..28ef912eae --- /dev/null +++ b/wifi/supplicant/1.4/ISupplicantStaIface.hal @@ -0,0 +1,39 @@ +/* + * 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::SupplicantStatus; +import @1.3::ISupplicantStaIface; + +/** + * Interface exposed by the supplicant for each station mode network + * interface (e.g wlan0) it controls. + */ +interface ISupplicantStaIface extends @1.3::ISupplicantStaIface { + + /** + * Get Connection capabilities + * + * @return status Status of the operation, and connection capabilities. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + */ + getConnectionCapabilities_1_4() + generates (SupplicantStatus status, ConnectionCapabilities capabilities); + +}; diff --git a/wifi/supplicant/1.4/types.hal b/wifi/supplicant/1.4/types.hal new file mode 100644 index 0000000000..79e367aa91 --- /dev/null +++ b/wifi/supplicant/1.4/types.hal @@ -0,0 +1,52 @@ +/* + * 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.3::ConnectionCapabilities; + +/** + * Detailed network mode for legacy network + */ +enum LegacyMode : uint32_t { + UNKNOWN = 0, + /** + * For 802.11a + */ + A_MODE = 1, + /** + * For 802.11b + */ + B_MODE = 2, + /** + * For 802.11g + */ + G_MODE = 3, +}; + +/** + * Connection Capabilities supported by current network and device + */ +struct ConnectionCapabilities { + /** + * Baseline information as defined in HAL 1.3. + */ + @1.3::ConnectionCapabilities V1_3; + /** + * detailed network mode for legacy network + */ + LegacyMode legacyMode; +}; diff --git a/wifi/supplicant/1.4/vts/OWNERS b/wifi/supplicant/1.4/vts/OWNERS new file mode 100644 index 0000000000..8bfb14882c --- /dev/null +++ b/wifi/supplicant/1.4/vts/OWNERS @@ -0,0 +1,2 @@ +rpius@google.com +etancohen@google.com diff --git a/wifi/supplicant/1.4/vts/functional/Android.bp b/wifi/supplicant/1.4/vts/functional/Android.bp new file mode 100644 index 0000000000..7f2ba70125 --- /dev/null +++ b/wifi/supplicant/1.4/vts/functional/Android.bp @@ -0,0 +1,71 @@ +// +// 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. +// + +cc_library_static { + name: "VtsHalWifiSupplicantV1_4TargetTestUtil", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["supplicant_hidl_test_utils_1_4.cpp"], + export_include_dirs: [ + ".", + ], + static_libs: [ + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiSupplicantV1_0TargetTestUtil", + "VtsHalWifiSupplicantV1_1TargetTestUtil", + "VtsHalWifiSupplicantV1_2TargetTestUtil", + "VtsHalWifiSupplicantV1_3TargetTestUtil", + "android.hardware.wifi.supplicant@1.0", + "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", + "libgmock", + "libwifi-system", + "libwifi-system-iface", + ], +} + +cc_test { + name: "VtsHalWifiSupplicantV1_4TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "supplicant_sta_iface_hidl_test.cpp", + ], + static_libs: [ + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiSupplicantV1_0TargetTestUtil", + "VtsHalWifiSupplicantV1_1TargetTestUtil", + "VtsHalWifiSupplicantV1_2TargetTestUtil", + "VtsHalWifiSupplicantV1_3TargetTestUtil", + "VtsHalWifiSupplicantV1_4TargetTestUtil", + "android.hardware.wifi.supplicant@1.0", + "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", + "libwifi-system", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], + disable_framework: true, +} diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp new file mode 100644 index 0000000000..3a59bd6297 --- /dev/null +++ b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.cpp @@ -0,0 +1,36 @@ +/* + * 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 + +#include "supplicant_hidl_test_utils.h" +#include "supplicant_hidl_test_utils_1_4.h" + +using ::android::sp; +using ::android::hardware::wifi::supplicant::V1_4::ISupplicant; +using ::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface; + +sp getSupplicantStaIface_1_4( + const android::sp& + supplicant) { + return ISupplicantStaIface::castFrom(getSupplicantStaIface(supplicant)); +} + +sp getSupplicant_1_4(const std::string& supplicant_instance_name, + bool isP2pOn) { + return ISupplicant::castFrom( + getSupplicant(supplicant_instance_name, isP2pOn)); +} diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h new file mode 100644 index 0000000000..bea4dc102a --- /dev/null +++ b/wifi/supplicant/1.4/vts/functional/supplicant_hidl_test_utils_1_4.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#ifndef SUPPLICANT_HIDL_TEST_UTILS_1_4_H +#define SUPPLICANT_HIDL_TEST_UTILS_1_4_H + +#include +#include + +android::sp +getSupplicantStaIface_1_4( + const android::sp& + supplicant); +android::sp +getSupplicant_1_4(const std::string& supplicant_instance_name, bool isP2pOn); + +#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_4_H */ diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp new file mode 100644 index 0000000000..2a4f5348b4 --- /dev/null +++ b/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -0,0 +1,94 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "supplicant_hidl_test_utils.h" +#include "supplicant_hidl_test_utils_1_4.h" + +using ::android::sp; +using ::android::hardware::Void; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; + +using ::android::hardware::wifi::supplicant::V1_4::ConnectionCapabilities; +using ::android::hardware::wifi::supplicant::V1_4::ISupplicant; +using ::android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface; + +class SupplicantStaIfaceHidlTest + : public ::testing::TestWithParam> { + public: + virtual void SetUp() override { + wifi_v1_0_instance_name_ = std::get<0>(GetParam()); + supplicant_v1_4_instance_name_ = std::get<1>(GetParam()); + isP2pOn_ = + testing::deviceSupportsFeature("android.hardware.wifi.direct"); + + stopSupplicant(wifi_v1_0_instance_name_); + startSupplicantAndWaitForHidlService(wifi_v1_0_instance_name_, + supplicant_v1_4_instance_name_); + supplicant_ = + getSupplicant_1_4(supplicant_v1_4_instance_name_, isP2pOn_); + EXPECT_TRUE(turnOnExcessiveLogging(supplicant_)); + sta_iface_ = getSupplicantStaIface_1_4(supplicant_); + ASSERT_NE(sta_iface_.get(), nullptr); + } + + virtual void TearDown() override { + stopSupplicant(wifi_v1_0_instance_name_); + } + + protected: + // ISupplicantStaIface object used for all tests in this fixture. + sp sta_iface_; + sp supplicant_; + bool isP2pOn_ = false; + std::string wifi_v1_0_instance_name_; + std::string supplicant_v1_4_instance_name_; +}; + +/* + * getConnectionCapabilities_1_4 + */ +TEST_P(SupplicantStaIfaceHidlTest, GetConnectionCapabilities) { + sta_iface_->getConnectionCapabilities_1_4( + [&](const SupplicantStatus& status, + ConnectionCapabilities /* capabilities */) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + }); +} + +INSTANTIATE_TEST_CASE_P( + PerInstance, SupplicantStaIfaceHidlTest, + testing::Combine( + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + android::hardware::wifi::V1_0::IWifi::descriptor)), + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + android::hardware::wifi::supplicant::V1_4::ISupplicant:: + descriptor))), + android::hardware::PrintInstanceTupleNameToString<>);