diff --git a/current.txt b/current.txt index 69ad1ed71a..71e2d912cb 100644 --- a/current.txt +++ b/current.txt @@ -369,4 +369,6 @@ a9d733eb0d555f2a6cb79a212810e81b56ecba0e31a8ffe0916de086a29e4f88 android.hardwar ee08280de21cb41e3ec26d6ed636c701b7f70516e71fb22f4fe60a13e603f406 android.hardware.wifi.hostapd@1.0::IHostapd b2479cd7a417a1cf4f3a22db4e4579e21bac38fdcaf381e2bf10176d05397e01 android.hardware.wifi.hostapd@1.0::types e362203b941f18bd4cba29a62adfa02453ed00d6be5b72cdb6c4d7e0bf394a40 android.hardware.wifi.supplicant@1.1::ISupplicant +21757d0e5dd4b7e4bd981a4a20531bca3c32271ad9777b17b74eb5a1ea508384 android.hardware.wifi.supplicant@1.1::ISupplicantStaIface +cd4330c3196bda1d642a32abfe23a7d64ebfbda721940643af6867af3b3f0aa9 android.hardware.wifi.supplicant@1.1::ISupplicantStaIfaceCallback 10ff2fae516346b86121368ce5790d5accdfcb73983246b813f3d488b66db45a android.hardware.wifi.supplicant@1.1::ISupplicantStaNetwork diff --git a/wifi/supplicant/1.1/Android.bp b/wifi/supplicant/1.1/Android.bp index fafd6ad422..832d1ad196 100644 --- a/wifi/supplicant/1.1/Android.bp +++ b/wifi/supplicant/1.1/Android.bp @@ -8,6 +8,8 @@ hidl_interface { }, srcs: [ "ISupplicant.hal", + "ISupplicantStaIface.hal", + "ISupplicantStaIfaceCallback.hal", "ISupplicantStaNetwork.hal", ], interfaces: [ diff --git a/wifi/supplicant/1.1/ISupplicantStaIface.hal b/wifi/supplicant/1.1/ISupplicantStaIface.hal new file mode 100644 index 0000000000..025cc6abfc --- /dev/null +++ b/wifi/supplicant/1.1/ISupplicantStaIface.hal @@ -0,0 +1,48 @@ +/* + * Copyright 2018 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.1; + +import @1.0::ISupplicantStaIface; +import @1.1::ISupplicantStaIfaceCallback; +import @1.0::SupplicantStatus; + +/** + * Interface exposed by the supplicant for each station mode network + * interface (e.g wlan0) it controls. + */ +interface ISupplicantStaIface extends @1.0::ISupplicantStaIface { + + /** + * Register for callbacks from this interface. + * + * These callbacks are invoked for events that are specific to this interface. + * Registration of multiple callback objects is supported. These objects must + * be automatically deleted when the corresponding client process is dead or + * if this interface is removed. + * + * @param callback An instance of the |ISupplicantStaIfaceCallback| HIDL + * interface object. + * @return status Status of the operation. + * Possible status codes: + * |SupplicantStatusCode.SUCCESS|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + registerCallback_1_1(ISupplicantStaIfaceCallback callback) + generates (SupplicantStatus status); +}; + diff --git a/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal new file mode 100644 index 0000000000..8b92ee5e70 --- /dev/null +++ b/wifi/supplicant/1.1/ISupplicantStaIfaceCallback.hal @@ -0,0 +1,45 @@ +/* + * Copyright 2018 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.1; + +import @1.0::ISupplicantStaIfaceCallback; + +/** + * Callback Interface exposed by the supplicant service + * for each station mode interface (ISupplicantStaIface). + * + * Clients need to host an instance of this HIDL interface object and + * pass a reference of the object to the supplicant via the + * corresponding |ISupplicantStaIface.registerCallback_1_1| method. + */ +interface ISupplicantStaIfaceCallback extends @1.0::ISupplicantStaIfaceCallback { + + /* EapErrorCode: Error code for EAP or EAP Method as per RFC-4186 */ + enum EapErrorCode : uint32_t { + SIM_GENERAL_FAILURE_AFTER_AUTH = 0, + SIM_TEMPORARILY_DENIED = 1026, + SIM_NOT_SUBSCRIBED = 1031, + SIM_GENERAL_FAILURE_BEFORE_AUTH = 16384, + SIM_VENDOR_SPECIFIC_EXPIRED_CERT = 16385, + }; + + /** + * Used to indicate an EAP authentication failure. + */ + oneway onEapFailure_1_1(EapErrorCode errorCode); +}; + diff --git a/wifi/supplicant/1.1/vts/functional/Android.bp b/wifi/supplicant/1.1/vts/functional/Android.bp index 3efe15d754..3e65453c2b 100644 --- a/wifi/supplicant/1.1/vts/functional/Android.bp +++ b/wifi/supplicant/1.1/vts/functional/Android.bp @@ -40,6 +40,7 @@ cc_test { srcs: [ "VtsHalWifiSupplicantV1_1TargetTest.cpp", "supplicant_hidl_test.cpp", + "supplicant_sta_iface_hidl_test.cpp", "supplicant_sta_network_hidl_test.cpp", ], static_libs: [ diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp index 3f17740474..04a5ed9d1a 100644 --- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp +++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.cpp @@ -21,6 +21,7 @@ #include "supplicant_hidl_test_utils_1_1.h" using ::android::hardware::wifi::supplicant::V1_1::ISupplicant; +using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIface; using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaNetwork; using ::android::sp; @@ -28,6 +29,10 @@ sp getSupplicant_1_1() { return ISupplicant::castFrom(getSupplicant()); } +sp getSupplicantStaIface_1_1() { + return ISupplicantStaIface::castFrom(getSupplicantStaIface()); +} + sp createSupplicantStaNetwork_1_1() { return ISupplicantStaNetwork::castFrom(createSupplicantStaNetwork()); } diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h index e7ce54ae66..1c13325f4f 100644 --- a/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h +++ b/wifi/supplicant/1.1/vts/functional/supplicant_hidl_test_utils_1_1.h @@ -18,11 +18,15 @@ #define SUPPLICANT_HIDL_TEST_UTILS_1_1_H #include +#include #include android::sp getSupplicant_1_1(); +android::sp + getSupplicantStaIface_1_1(); + android::sp createSupplicantStaNetwork_1_1(); diff --git a/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp new file mode 100644 index 0000000000..c5e6319de9 --- /dev/null +++ b/wifi/supplicant/1.1/vts/functional/supplicant_sta_iface_hidl_test.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2018 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 "supplicant_hidl_test_utils.h" +#include "supplicant_hidl_test_utils_1_1.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_1::ISupplicantStaIface; +using ::android::hardware::wifi::supplicant::V1_1::ISupplicantStaIfaceCallback; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatus; +using ::android::hardware::wifi::supplicant::V1_0::SupplicantStatusCode; + +class SupplicantStaIfaceHidlTest + : public ::testing::VtsHalHidlTargetTestBase { + public: + virtual void SetUp() override { + startSupplicantAndWaitForHidlService(); + EXPECT_TRUE(turnOnExcessiveLogging()); + sta_iface_ = getSupplicantStaIface_1_1(); + ASSERT_NE(sta_iface_.get(), nullptr); + } + + virtual void TearDown() override { stopSupplicant(); } + + protected: + // ISupplicantStaIface object used for all tests in this fixture. + sp sta_iface_; +}; + +class IfaceCallback : public ISupplicantStaIfaceCallback { + Return onNetworkAdded(uint32_t /* id */) override { return Void(); } + Return onNetworkRemoved(uint32_t /* id */) override { return Void(); } + Return onStateChanged( + ISupplicantStaIfaceCallback::State /* newState */, + const hidl_array& /*bssid */, uint32_t /* id */, + const hidl_vec& /* ssid */) override { + return Void(); + } + Return onAnqpQueryDone( + const hidl_array& /* bssid */, + const ISupplicantStaIfaceCallback::AnqpData& /* data */, + const ISupplicantStaIfaceCallback::Hs20AnqpData& /* hs20Data */) + override { + return Void(); + } + virtual Return onHs20IconQueryDone( + const hidl_array& /* bssid */, + const hidl_string& /* fileName */, + const hidl_vec& /* data */) override { + return Void(); + } + virtual Return onHs20SubscriptionRemediation( + const hidl_array& /* bssid */, + ISupplicantStaIfaceCallback::OsuMethod /* osuMethod */, + const hidl_string& /* url*/) override { + return Void(); + } + Return onHs20DeauthImminentNotice( + const hidl_array& /* bssid */, uint32_t /* reasonCode */, + uint32_t /* reAuthDelayInSec */, + const hidl_string& /* url */) override { + return Void(); + } + Return onDisconnected(const hidl_array& /* bssid */, + bool /* locallyGenerated */, + ISupplicantStaIfaceCallback::ReasonCode + /* reasonCode */) override { + return Void(); + } + Return onAssociationRejected( + const hidl_array& /* bssid */, + ISupplicantStaIfaceCallback::StatusCode /* statusCode */, + bool /*timedOut */) override { + return Void(); + } + Return onAuthenticationTimeout( + const hidl_array& /* bssid */) override { + return Void(); + } + Return onBssidChanged( + ISupplicantStaIfaceCallback::BssidChangeReason /* reason */, + const hidl_array& /* bssid */) override { + return Void(); + } + Return onEapFailure() override { return Void(); } + Return onEapFailure_1_1( + ISupplicantStaIfaceCallback::EapErrorCode /* eapErrorCode */) override { + return Void(); + } + Return onWpsEventSuccess() override { return Void(); } + Return onWpsEventFail( + const hidl_array& /* bssid */, + ISupplicantStaIfaceCallback::WpsConfigError /* configError */, + ISupplicantStaIfaceCallback::WpsErrorIndication /* errorInd */) + override { + return Void(); + } + Return onWpsEventPbcOverlap() override { return Void(); } + Return onExtRadioWorkStart(uint32_t /* id */) override { + return Void(); + } + Return onExtRadioWorkTimeout(uint32_t /* id*/) override { + return Void(); + } +}; + +/* + * RegisterCallback_1_1 + */ +TEST_F(SupplicantStaIfaceHidlTest, RegisterCallback_1_1) { + sta_iface_->registerCallback_1_1( + new IfaceCallback(), [](const SupplicantStatus& status) { + EXPECT_EQ(SupplicantStatusCode::SUCCESS, status.code); + }); +}