Merge changes from topic 'fix_configure_chip' into oc-dev

am: 5eca115b68

Change-Id: Ice788fc3d3c9226fa47df0b598927ea4a349332e
This commit is contained in:
Ningyuan Wang 2017-04-27 01:13:52 +00:00 committed by android-build-merger
commit 24e03c6303
4 changed files with 17 additions and 9 deletions

View file

@ -161,7 +161,7 @@ f7e6e747910a3cd0a35846141e3b990a6a612a297b2b70ccd5740b646a450a8c android.hardwar
4b962968a7df4ab104d1315d66a0a7348a713fecbb5d2c1b23688494458f37ce android.hardware.vr@1.0::IVr
b9be36719a8ad534000a51ea07be91be94c405bf1e038ae825acf65087ffd378 android.hardware.wifi@1.0::IWifi
ee0224ee18813506d9d6f13d8c8e4679f053c290a443a52a7c52a5d3c852262b android.hardware.wifi@1.0::IWifiApIface
50390d78cb83c9912235e17f25255a19429b5e7094c8980bea28623873ce5e3d android.hardware.wifi@1.0::IWifiChip
f3eecc489deb4c74892f59eb7adb769063bd5c354ac132b626a5f42b363d36bc android.hardware.wifi@1.0::IWifiChip
a1b988377645a58e5e2542ca2bad4e17c21a4a389213d05de2f0e32d57b7d339 android.hardware.wifi@1.0::IWifiChipEventCallback
5ed6760ce77e84bc6c49d1acb3f7d8117c9176b3f06514bc44ad3af84c80dcfe android.hardware.wifi@1.0::IWifiEventCallback
6b9ad43a5efbe6ca214f751e22ce43cf5cd4d5d5f2cba80f24ccd3755a72401c android.hardware.wifi@1.0::IWifiIface

View file

@ -220,7 +220,12 @@ interface IWifiChip {
getAvailableModes() generates (WifiStatus status, vec<ChipMode> modes);
/**
* Reconfigure the Chip.
* Configure the Chip.
* This may NOT be called to reconfigure a chip due to an internal
* limitation. Calling this when chip is already configured in a different
* mode must trigger an ERROR_NOT_SUPPORTED failure.
* If you want to do reconfiguration, please call IWifi.stop() and IWifi.start()
* to restart Wifi HAL before calling this.
* Any existing |IWifiIface| objects must be marked invalid after this call.
* If this fails then the chips is now in an undefined state and
* configureChip must be called again.
@ -234,6 +239,7 @@ interface IWifiChip {
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
configureChip(ChipModeId modeId) generates (WifiStatus status);

View file

@ -804,14 +804,12 @@ WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) {
WifiStatus WifiChip::handleChipConfiguration(ChipModeId mode_id) {
// If the chip is already configured in a different mode, stop
// the legacy HAL and then start it after firmware mode change.
// Currently the underlying implementation has a deadlock issue.
// We should return ERROR_NOT_SUPPORTED if chip is already configured in
// a different mode.
if (current_mode_id_ != kInvalidModeId) {
invalidateAndRemoveAllIfaces();
legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stop([]() {});
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to stop legacy HAL: "
<< legacyErrorToString(legacy_status);
return createWifiStatusFromLegacyError(legacy_status);
}
// TODO(b/37446050): Fix the deadlock.
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}
bool success;
if (mode_id == kStaChipModeId) {

View file

@ -173,8 +173,12 @@ TEST_F(WifiChipHidlTest, ConfigureChip) {
EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_modes.first.code);
EXPECT_LT(0u, status_and_modes.second.size());
for (const auto& mode : status_and_modes.second) {
// configureChip() requires to be called with a fresh IWifiChip object.
wifi_chip_ = getWifiChip();
ASSERT_NE(nullptr, wifi_chip_.get());
EXPECT_EQ(WifiStatusCode::SUCCESS,
HIDL_INVOKE(wifi_chip_, configureChip, mode.id).code);
stopWifi();
}
}