Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48b4ce2e authored by Etan Cohen's avatar Etan Cohen Committed by Gerrit Code Review
Browse files

Merge "[WIFI][HIDL] Add device-based feature flag support"

parents 78cfef9f c5700400
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ LOCAL_MODULE := android.hardware.wifi@1.0-service
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CPPFLAGS := -Wall -Werror -Wextra
ifdef WIFI_HIDL_FEATURE_AWARE
LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE
endif
LOCAL_SRC_FILES := \
    hidl_struct_util.cpp \
    hidl_sync_util.cpp \
+24 −14
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "hidl_return_util.h"
#include "hidl_struct_util.h"
#include "wifi_chip.h"
#include "wifi_feature_flags.h"
#include "wifi_status_util.h"

namespace {
@@ -388,16 +389,21 @@ WifiChip::getAvailableModesInternal() {
  // The chip combination supported for current devices is fixed for now with
  // 2 separate modes of operation:
  // Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN iface operations
  // concurrently.
  // concurrently [NAN conditional on wifiHidlFeatureAware]
  // Mode 2 (AP mode): Will support 1 AP iface operations.
  // TODO (b/32997844): Read this from some device specific flags in the
  // makefile.
  // STA mode iface combinations.
  const IWifiChip::ChipIfaceCombinationLimit
      sta_chip_iface_combination_limit_1 = {{IfaceType::STA}, 1};
  const IWifiChip::ChipIfaceCombinationLimit
  IWifiChip::ChipIfaceCombinationLimit sta_chip_iface_combination_limit_2;
  if (WifiFeatureFlags::wifiHidlFeatureAware) {
    sta_chip_iface_combination_limit_2 = {{IfaceType::P2P, IfaceType::NAN},
                                          1};
  } else {
    sta_chip_iface_combination_limit_2 = {{IfaceType::P2P},
                                          1};
  }
  const IWifiChip::ChipIfaceCombination sta_chip_iface_combination = {
      {sta_chip_iface_combination_limit_1, sta_chip_iface_combination_limit_2}};
  const IWifiChip::ChipMode sta_chip_mode = {kStaChipModeId,
@@ -552,6 +558,7 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) {

std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
  // Only 1 of NAN or P2P iface can be active at a time.
  if (WifiFeatureFlags::wifiHidlFeatureAware) {
    if (current_mode_id_ != kStaChipModeId || nan_iface_.get() ||
        p2p_iface_.get()) {
      return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
@@ -564,6 +571,9 @@ std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
      }
    }
    return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
  } else {
    return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
  }
}

std::pair<WifiStatus, std::vector<hidl_string>>
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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 WIFI_FEATURE_FLAGS_H_
#define WIFI_FEATURE_FLAGS_H_

namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {

class WifiFeatureFlags {
 public:
#ifdef WIFI_HIDL_FEATURE_AWARE
  static const bool wifiHidlFeatureAware = true;
#else
  static const bool wifiHidlFeatureAware = false;
#endif // WIFI_HIDL_FEATURE_AWARE
};

}  // namespace implementation
}  // namespace V1_0
}  // namespace wifi
}  // namespace hardware
}  // namespace android

#endif  // WIFI_FEATURE_FLAGS_H_