Revert "Request Automatic Channel Selection"

This reverts commit 99ebcbd4bb.

Bug: 71878020
Test: ./runtests.sh (on walleye)
Test: manual

Manual test
-----------
- enable 5 GHz wifi hotspot from settings
$ adb logcat -d -b main hostapd '*:S' -e 'ACS' | wc -l
0
- verify that another phone shows walleye's softap in scan results

Change-Id: I43208bf09b70055eea3f96114bf2ecbcbb8cb60e
This commit is contained in:
mukesh agrawal 2018-01-11 20:09:07 -08:00 committed by Mukesh Agrawal
parent 99ebcbd4bb
commit 4b7b1c8235
7 changed files with 13 additions and 39 deletions

View File

@ -26,10 +26,6 @@ interface IApInterface {
const int ENCRYPTION_TYPE_WPA = 1;
const int ENCRYPTION_TYPE_WPA2 = 2;
const int BAND_2G = 0;
const int BAND_5G = 1;
const int BAND_ANY = 2;
// Start up an instance of hostapd associated with this interface.
//
// @param callback Object to add a set of event callbacks.
@ -45,12 +41,12 @@ interface IApInterface {
//
// @param ssid string of <=32 bytes to use as the SSID for this AP.
// @param isHidden True iff the AP should not broadcast its SSID.
// @param band one of the BAND_* above.
// @param channel WiFi channel to expose the AP on.
// @param encryptionType one of ENCRYPTION_TYPE* above.
// @param passphrase string of bytes to use as the passphrase for this AP.
// Ignored if encryptionType is None.
// @return true on success.
boolean writeHostapdConfig(in byte[] ssid, boolean isHidden, int band,
boolean writeHostapdConfig(in byte[] ssid, boolean isHidden, int channel,
int encryptionType, in byte[] passphrase);
// Retrieve the name of the network interface corresponding to this

View File

@ -67,7 +67,7 @@ binder::Status ApInterfaceBinder::stopHostapd(bool* out_success) {
binder::Status ApInterfaceBinder::writeHostapdConfig(
const std::vector<uint8_t>& ssid,
bool is_hidden,
int32_t binder_band_type,
int32_t channel,
int32_t binder_encryption_type,
const std::vector<uint8_t>& passphrase,
bool* out_success) {
@ -93,25 +93,8 @@ binder::Status ApInterfaceBinder::writeHostapdConfig(
return binder::Status::ok();
}
HostapdManager::BandType band_type;
switch (binder_band_type) {
case IApInterface::BAND_2G:
band_type = HostapdManager::BandType::kBand2G;
break;
case IApInterface::BAND_5G:
band_type = HostapdManager::BandType::kBand5G;
break;
case IApInterface::BAND_ANY:
band_type = HostapdManager::BandType::kBandAny;
break;
default:
LOG(ERROR) << "Unknown band type: " << binder_band_type;
return binder::Status::ok();
}
*out_success = impl_->WriteHostapdConfig(
ssid, is_hidden, band_type, encryption_type, passphrase);
ssid, is_hidden, channel, encryption_type, passphrase);
return binder::Status::ok();
}

View File

@ -46,7 +46,7 @@ class ApInterfaceBinder : public android::net::wifi::BnApInterface {
binder::Status stopHostapd(bool* out_success) override;
binder::Status writeHostapdConfig(const std::vector<uint8_t>& ssid,
bool is_hidden,
int32_t band_type,
int32_t channel,
int32_t encryption_type,
const std::vector<uint8_t>& passphrase,
bool* out_success) override;

View File

@ -32,7 +32,6 @@ using std::unique_ptr;
using std::vector;
using EncryptionType = android::wifi_system::HostapdManager::EncryptionType;
using BandType = android::wifi_system::HostapdManager::BandType;
using namespace std::placeholders;
@ -113,12 +112,11 @@ bool ApInterfaceImpl::StopHostapd() {
bool ApInterfaceImpl::WriteHostapdConfig(const vector<uint8_t>& ssid,
bool is_hidden,
BandType band,
int32_t channel,
EncryptionType encryption_type,
const vector<uint8_t>& passphrase) {
string config = hostapd_manager_->CreateHostapdConfig(
interface_name_, ssid, is_hidden,
band, encryption_type, passphrase);
interface_name_, ssid, is_hidden, channel, encryption_type, passphrase);
if (config.empty()) {
return false;

View File

@ -55,7 +55,7 @@ class ApInterfaceImpl {
bool WriteHostapdConfig(
const std::vector<uint8_t>& ssid,
bool is_hidden,
wifi_system::HostapdManager::BandType band_type,
int32_t channel,
wifi_system::HostapdManager::EncryptionType encryption_type,
const std::vector<uint8_t>& passphrase);
std::string GetInterfaceName() { return interface_name_; }

View File

@ -36,9 +36,7 @@ using std::placeholders::_2;
using std::unique_ptr;
using std::vector;
using testing::NiceMock;
using testing::Not;
using testing::Invoke;
using testing::IsEmpty;
using testing::Return;
using testing::Sequence;
using testing::StrEq;
@ -115,14 +113,13 @@ TEST_F(ApInterfaceImplTest, ShouldReportStopSuccess) {
}
TEST_F(ApInterfaceImplTest, ShouldRejectInvalidConfig) {
EXPECT_CALL(*hostapd_manager_, CreateHostapdConfig(
_, _, _, _, Not(HostapdManager::EncryptionType::kOpen), IsEmpty()))
EXPECT_CALL(*hostapd_manager_, CreateHostapdConfig(_, _, _, _, _, _))
.WillOnce(Return(""));
EXPECT_CALL(*hostapd_manager_, WriteHostapdConfig(_)).Times(0);
EXPECT_FALSE(ap_interface_->WriteHostapdConfig(
vector<uint8_t>(),
false,
HostapdManager::BandType::kBandAny,
0,
HostapdManager::EncryptionType::kWpa2,
vector<uint8_t>()));
}

View File

@ -109,7 +109,7 @@ TEST(ApInterfaceTest, CanStartStopHostapd) {
EXPECT_TRUE(ap_interface->writeHostapdConfig(
vector<uint8_t>(kValidSsid, kValidSsid + sizeof(kValidSsid) - 1),
false,
IApInterface::BAND_5G,
6,
IApInterface::ENCRYPTION_TYPE_WPA2,
vector<uint8_t>(kValidPassphrase,
kValidPassphrase + sizeof(kValidPassphrase) - 1),
@ -166,7 +166,7 @@ TEST(ApInterfaceTest, CanWriteHostapdConfig) {
EXPECT_TRUE(ap_interface->writeHostapdConfig(
vector<uint8_t>(kValidSsid, kValidSsid + sizeof(kValidSsid) - 1),
false,
IApInterface::BAND_5G,
2,
IApInterface::ENCRYPTION_TYPE_WPA2,
vector<uint8_t>(kValidPassphrase,
kValidPassphrase + sizeof(kValidPassphrase) - 1),
@ -177,7 +177,7 @@ TEST(ApInterfaceTest, CanWriteHostapdConfig) {
EXPECT_TRUE(ap_interface->writeHostapdConfig(
vector<uint8_t>(kInvalidSsid, kInvalidSsid + sizeof(kInvalidSsid) - 1),
false,
IApInterface::BAND_5G,
2,
IApInterface::ENCRYPTION_TYPE_WPA2,
vector<uint8_t>(kValidPassphrase,
kValidPassphrase + sizeof(kValidPassphrase) - 1),