Merge "wifi: Support 11b only mode"

This commit is contained in:
Kai Shi
2020-08-26 00:23:13 +00:00
committed by Android (Google) Code Review
10 changed files with 334 additions and 1 deletions

View File

@@ -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

View File

@@ -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);
}
});
}

View File

@@ -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",

View File

@@ -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);
};

View File

@@ -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;
};

View File

@@ -0,0 +1,2 @@
rpius@google.com
etancohen@google.com

View File

@@ -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,
}

View File

@@ -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 <android-base/logging.h>
#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<ISupplicantStaIface> getSupplicantStaIface_1_4(
const android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>&
supplicant) {
return ISupplicantStaIface::castFrom(getSupplicantStaIface(supplicant));
}
sp<ISupplicant> getSupplicant_1_4(const std::string& supplicant_instance_name,
bool isP2pOn) {
return ISupplicant::castFrom(
getSupplicant(supplicant_instance_name, isP2pOn));
}

View File

@@ -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 <android/hardware/wifi/supplicant/1.4/ISupplicant.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicantStaIface.h>
android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicantStaIface>
getSupplicantStaIface_1_4(
const android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>&
supplicant);
android::sp<android::hardware::wifi::supplicant::V1_4::ISupplicant>
getSupplicant_1_4(const std::string& supplicant_instance_name, bool isP2pOn);
#endif /* SUPPLICANT_HIDL_TEST_UTILS_1_4_H */

View File

@@ -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 <VtsCoreUtil.h>
#include <android/hardware/wifi/1.1/IWifi.h>
#include <android/hardware/wifi/supplicant/1.1/ISupplicant.h>
#include <android/hardware/wifi/supplicant/1.2/types.h>
#include <android/hardware/wifi/supplicant/1.3/ISupplicant.h>
#include <android/hardware/wifi/supplicant/1.3/types.h>
#include <android/hardware/wifi/supplicant/1.4/ISupplicant.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>
#include <hidl/ServiceManagement.h>
#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<std::tuple<std::string, std::string>> {
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<ISupplicantStaIface> sta_iface_;
sp<ISupplicant> 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<>);