From df75bc1dfbc336837b7171c77e8811dfe214fb55 Mon Sep 17 00:00:00 2001 From: lesl Date: Tue, 4 Aug 2020 17:04:57 +0800 Subject: [PATCH] wifi: Upgrade hostapd HIDL to 1.3 1. Upgrade hostapd HIDL to 1.3 2. Add new callback register in 1.3 3. Update 1.1 vts to ignore register callback test 4. Add Wifi generation define. sinca 1.3 support the new callback Test: Manuel Test. Hotspot works normally. Test: atest VtsHalWifiHostapdV1_0TargetTest Test: atest VtsHalWifiHostapdV1_1TargetTest Test: atest VtsHalWifiHostapdV1_2TargetTest Bug: 151189102 Change-Id: I21b81ce21b8bd22b4ffe70c9b69d36810b1f925f --- .../compatibility_matrix.current.xml | 2 +- wifi/hostapd/1.1/vts/functional/Android.bp | 8 +++- .../1.1/vts/functional/hostapd_hidl_test.cpp | 9 ++++ wifi/hostapd/1.3/Android.bp | 22 ++++++++++ wifi/hostapd/1.3/IHostapd.hal | 44 +++++++++++++++++++ wifi/hostapd/1.3/IHostapdCallback.hal | 27 ++++++++++++ wifi/hostapd/1.3/types.hal | 37 ++++++++++++++++ 7 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 wifi/hostapd/1.3/Android.bp create mode 100644 wifi/hostapd/1.3/IHostapd.hal create mode 100644 wifi/hostapd/1.3/IHostapdCallback.hal create mode 100644 wifi/hostapd/1.3/types.hal diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 946392458e..d0b08a99bb 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -537,7 +537,7 @@ android.hardware.wifi.hostapd - 1.0-2 + 1.0-3 IHostapd default diff --git a/wifi/hostapd/1.1/vts/functional/Android.bp b/wifi/hostapd/1.1/vts/functional/Android.bp index 291eceb80c..61a8dfd813 100644 --- a/wifi/hostapd/1.1/vts/functional/Android.bp +++ b/wifi/hostapd/1.1/vts/functional/Android.bp @@ -25,11 +25,15 @@ cc_test { "VtsHalWifiHostapdV1_0TargetTestUtil", "android.hardware.wifi.hostapd@1.0", "android.hardware.wifi.hostapd@1.1", + "android.hardware.wifi.hostapd@1.2", + "android.hardware.wifi.hostapd@1.3", "android.hardware.wifi@1.0", "libgmock", "libwifi-system", "libwifi-system-iface", ], - test_suites: ["general-tests", "vts"], + test_suites: [ + "general-tests", + "vts", + ], } - diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp index 345cf312d4..0162a9918e 100644 --- a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp +++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "hostapd_hidl_call_util.h" #include "hostapd_hidl_test_utils.h" @@ -43,6 +44,7 @@ constexpr unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1', constexpr char kNwPassphrase[] = "test12345"; constexpr int kIfaceChannel = 6; constexpr int kIfaceInvalidChannel = 567; + } // namespace class HostapdHidlTest @@ -170,10 +172,17 @@ class IfaceCallback : public IHostapdCallback { } }; +bool is_1_3(const sp& hostapd) { + sp<::android::hardware::wifi::hostapd::V1_3::IHostapd> hostapd_1_3 = + ::android::hardware::wifi::hostapd::V1_3::IHostapd::castFrom(hostapd); + return hostapd_1_3.get() != nullptr; +} + /* * RegisterCallback */ TEST_P(HostapdHidlTest, registerCallback) { + if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore since current HIDL over 1.3"; hostapd_->registerCallback( new IfaceCallback(), [](const HostapdStatus& status) { EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); diff --git a/wifi/hostapd/1.3/Android.bp b/wifi/hostapd/1.3/Android.bp new file mode 100644 index 0000000000..aef3267d14 --- /dev/null +++ b/wifi/hostapd/1.3/Android.bp @@ -0,0 +1,22 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.wifi.hostapd@1.3", + root: "android.hardware", + srcs: [ + "types.hal", + "IHostapd.hal", + "IHostapdCallback.hal", + ], + interfaces: [ + "android.hardware.wifi.hostapd@1.0", + "android.hardware.wifi.hostapd@1.1", + "android.hardware.wifi.hostapd@1.2", + "android.hardware.wifi.supplicant@1.0", + "android.hidl.base@1.0", + ], + gen_java: true, + apex_available: [ + "com.android.wifi", + ], +} diff --git a/wifi/hostapd/1.3/IHostapd.hal b/wifi/hostapd/1.3/IHostapd.hal new file mode 100644 index 0000000000..7ac20e43e5 --- /dev/null +++ b/wifi/hostapd/1.3/IHostapd.hal @@ -0,0 +1,44 @@ +/* + * 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.hostapd@1.3; + +import @1.2::IHostapd; +import @1.2::HostapdStatus; + +import IHostapdCallback; +/** + * Top-level object for managing SoftAPs. + */ +interface IHostapd extends @1.2::IHostapd { + /** + * Register for callbacks from the hostapd service. + * + * These callbacks are invoked for global events that are not specific + * to any interface or network. Registration of multiple callback + * objects is supported. These objects must be deleted when the corresponding + * client process is dead. + * + * @param callback An instance of the |IHostapdCallback| HIDL interface + * object. + * @return status Status of the operation. + * Possible status codes: + * |HostapdStatusCode.SUCCESS|, + * |HostapdStatusCode.FAILURE_UNKNOWN| + */ + registerCallback_1_3(IHostapdCallback callback) + generates (HostapdStatus status); +}; diff --git a/wifi/hostapd/1.3/IHostapdCallback.hal b/wifi/hostapd/1.3/IHostapdCallback.hal new file mode 100644 index 0000000000..5202178935 --- /dev/null +++ b/wifi/hostapd/1.3/IHostapdCallback.hal @@ -0,0 +1,27 @@ +/* + * 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.hostapd@1.3; + +import @1.1::IHostapdCallback; +import Generation; + +/** + * Top-level callback object for managing SoftAPs. + */ +interface IHostapdCallback extends @1.1::IHostapdCallback { + oneway onInterfaceInfoChanged(string ifaceName, Generation generation); +}; diff --git a/wifi/hostapd/1.3/types.hal b/wifi/hostapd/1.3/types.hal new file mode 100644 index 0000000000..ce092c07a9 --- /dev/null +++ b/wifi/hostapd/1.3/types.hal @@ -0,0 +1,37 @@ +/* + * 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.hostapd@1.3; + +/** + * The wifi generation which AP reside on. + * It depends on hw mode and HT/VHT capabilities in hostapd. + * + * WIFI_STANDARD_LEGACY = (hw_mode is HOSTAPD_MODE_IEEE80211B) or + * (hw_mode is HOSTAPD_MODE_IEEE80211G and HT is 0). + * WIFI_STANDARD_11N = [hw_mode is HOSTAPD_MODE_IEEE80211G and (HT is 1 or HT40 is 1)] or + * [hw_mode is HOSTAPD_MODE_IEEE80211A and VHT is 0]. + * WIFI_STANDARD_11AC = hw_mode is HOSTAPD_MODE_IEEE80211A and VHT is 1. + * WIFI_STANDARD_11AX = hw_mode is HOSTAPD_MODE_IEEE80211AX. + */ +enum Generation : uint32_t { + WIFI_STANDARD_UNKNOWN = -1, + WIFI_STANDARD_LEGACY = 0, + WIFI_STANDARD_11N = 1, + WIFI_STANDARD_11AC = 2, + WIFI_STANDARD_11AX = 3, +}; +