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

Commit 5194b353 authored by Quang Luong's avatar Quang Luong Committed by Android (Google) Code Review
Browse files

Merge "Add IfaceConcurrencyType and related methods for AP_BRIDGED concurrency"

parents 2f5c7971 5d8805e2
Loading
Loading
Loading
Loading
+102 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.wifi@1.6;

import @1.0::ChipModeId;
import @1.0::IWifiIface;
import @1.0::WifiStatus;
import @1.5::WifiBand;
@@ -100,6 +101,107 @@ interface IWifiChip extends @1.5::IWifiChip {
        bitfield<UsableChannelFilter> filterMask)
        generates (WifiStatus status, vec<WifiUsableChannel> channels);

    /**
     * Set of interface concurrency types with the maximum number of interfaces that can have
     * one of the specified concurrency types for a given ChipConcurrencyCombination. See
     * ChipConcurrencyCombination for examples.
     */
    struct ChipConcurrencyCombinationLimit {
        // Each IfaceConcurrencyType must occur at most once.
        vec<IfaceConcurrencyType> types;
        uint32_t maxIfaces;
    };

    /**
     * Set of interfaces that can operate concurrently when in a given mode. See
     * ChipMode below.
     *
     * For example:
     *   [{STA} <= 2]
     *       At most two STA interfaces are supported
     *       [], [STA], [STA+STA]
     *
     *   [{STA} <= 1, {NAN} <= 1, {AP_BRIDGED} <= 1]
     *       Any combination of STA, NAN, AP_BRIDGED
     *       [], [STA], [NAN], [AP_BRIDGED], [STA+NAN], [STA+AP_BRIDGED], [NAN+AP_BRIDGED],
     *       [STA+NAN+AP_BRIDGED]
     *
     *   [{STA} <= 1, {NAN,P2P} <= 1]
     *       Optionally a STA and either NAN or P2P
     *       [], [STA], [STA+NAN], [STA+P2P], [NAN], [P2P]
     *       Not included [NAN+P2P], [STA+NAN+P2P]
     *
     *   [{STA} <= 1, {STA,NAN} <= 1]
     *       Optionally a STA and either a second STA or a NAN
     *       [], [STA], [STA+NAN], [STA+STA], [NAN]
     *       Not included [STA+STA+NAN]
     */
    struct ChipConcurrencyCombination {
        vec<ChipConcurrencyCombinationLimit> limits;
    };

    /**
     * A mode that the chip can be put in. A mode defines a set of constraints on
     * the interfaces that can exist while in that mode. Modes define a unit of
     * configuration where all interfaces must be torn down to switch to a
     * different mode. Some HALs may only have a single mode, but an example where
     * multiple modes would be required is if a chip has different firmwares with
     * different capabilities.
     *
     * When in a mode, it must be possible to perform any combination of creating
     * and removing interfaces as long as at least one of the
     * ChipConcurrencyCombinations is satisfied. This means that if a chip has two
     * available combinations, [{STA} <= 1] and [{AP_BRIDGED} <= 1] then it is expected
     * that exactly one STA type or one AP_BRIDGED type can be created, but it
     * is not expected that both a STA and AP_BRIDGED type  could be created. If it
     * was then there would be a single available combination
     * [{STA} <=1, {AP_BRIDGED} <= 1].
     *
     * When switching between two available combinations it is expected that
     * interfaces only supported by the initial combination must be removed until
     * the target combination is also satisfied. At that point new interfaces
     * satisfying only the target combination can be added (meaning the initial
     * combination limits will no longer satisfied). The addition of these new
     * interfaces must not impact the existence of interfaces that satisfy both
     * combinations.
     *
     * For example, a chip with available combinations:
     *     [{STA} <= 2, {NAN} <=1] and [{STA} <=1, {NAN} <= 1, {AP_BRIDGED} <= 1}]
     * If the chip currently has 3 interfaces STA, STA and NAN and wants to add an
     * AP_BRIDGED interface in place of one of the STAs then first one of the STA
     * interfaces must be removed and then the AP interface can be created after
     * the STA had been torn down. During this process the remaining STA and NAN
     * interfaces must not be removed/recreated.
     *
     * If a chip does not support this kind of reconfiguration in this mode then
     * the combinations must be separated into two separate modes. Before
     * switching modes all interfaces must be torn down, the mode switch must be
     * enacted and when it completes the new interfaces must be brought up.
     */
    struct ChipMode {
        /**
         * Id that can be used to put the chip in this mode.
         */
        ChipModeId id;

        /**
         * A list of the possible interface concurrency type combinations that the chip can have
         * while in this mode.
         */
        vec<ChipConcurrencyCombination> availableCombinations;
    };

    /**
     * Get the set of operation modes that the chip supports.
     *
     * @return status WifiStatus of the operation.
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
     * @return modes List of modes supported by the device.
     */
    getAvailableModes_1_6() generates (WifiStatus status, vec<ChipMode> modes);

    /**
     * Retrieve the list of all the possible radio combinations supported by this
     * chip.
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags {
  public:
    MockWifiFeatureFlags();

    MOCK_METHOD1(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>(bool is_primary));
    MOCK_METHOD1(getChipModes, std::vector<V1_6::IWifiChip::ChipMode>(bool is_primary));
    MOCK_METHOD0(isApMacRandomizationDisabled, bool());
};

+95 −90

File changed.

Preview size limit exceeded, changes collapsed.

+103 −69
Original line number Diff line number Diff line
@@ -728,6 +728,11 @@ Return<void> WifiChip::getSupportedRadioCombinationsMatrix(
                           &WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb);
}

Return<void> WifiChip::getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) {
    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                           &WifiChip::getAvailableModesInternal_1_6, hidl_status_cb);
}

void WifiChip::invalidateAndRemoveAllIfaces() {
    invalidateAndClearBridgedApAll();
    invalidateAndClearAll(ap_ifaces_);
@@ -784,9 +789,10 @@ std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal() {
    return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0};
}

std::pair<WifiStatus, std::vector<V1_4::IWifiChip::ChipMode>>
std::pair<WifiStatus, std::vector<V1_0::IWifiChip::ChipMode>>
WifiChip::getAvailableModesInternal() {
    return {createWifiStatus(WifiStatusCode::SUCCESS), modes_};
    // Deprecated support -- use getAvailableModes_1_6.
    return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}};
}

WifiStatus WifiChip::configureChipInternal(
@@ -910,7 +916,7 @@ sp<WifiApIface> WifiChip::newWifiApIface(std::string& ifname) {
}

std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createApIfaceInternal() {
    if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) {
    if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) {
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    }
    std::string ifname = allocateApIfaceName();
@@ -923,7 +929,7 @@ std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createApIfaceInternal()
}

std::pair<WifiStatus, sp<V1_5::IWifiApIface>> WifiChip::createBridgedApIfaceInternal() {
    if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) {
    if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) {
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    }
    std::vector<std::string> ap_instances = allocateBridgedApInstanceNames();
@@ -1040,7 +1046,7 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal(
}

std::pair<WifiStatus, sp<V1_4::IWifiNanIface>> WifiChip::createNanIfaceInternal() {
    if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::NAN)) {
    if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN)) {
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    }
    bool is_dedicated_iface = true;
@@ -1092,7 +1098,7 @@ WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) {
}

std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::createP2pIfaceInternal() {
    if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::P2P)) {
    if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) {
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    }
    std::string ifname = getPredefinedP2pIfaceName();
@@ -1136,7 +1142,7 @@ WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) {
}

std::pair<WifiStatus, sp<V1_6::IWifiStaIface>> WifiChip::createStaIfaceInternal() {
    if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) {
    if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) {
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
    }
    std::string ifname = allocateStaIfaceName();
@@ -1436,7 +1442,8 @@ WifiStatus WifiChip::triggerSubsystemRestartInternal() {

std::pair<WifiStatus, sp<V1_6::IWifiRttController>> WifiChip::createRttControllerInternal_1_6(
        const sp<IWifiIface>& bound_iface) {
    if (sta_ifaces_.size() == 0 && !canCurrentModeSupportIfaceOfType(IfaceType::STA)) {
    if (sta_ifaces_.size() == 0 &&
        !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) {
        LOG(ERROR) << "createRttControllerInternal_1_6: Chip cannot support STAs "
                      "(and RTT by extension)";
        return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
@@ -1489,6 +1496,11 @@ WifiChip::getSupportedRadioCombinationsMatrixInternal() {
    return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix};
}

std::pair<WifiStatus, std::vector<V1_6::IWifiChip::ChipMode>>
WifiChip::getAvailableModesInternal_1_6() {
    return {createWifiStatus(WifiStatusCode::SUCCESS), modes_};
}

WifiStatus WifiChip::handleChipConfiguration(
        /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id) {
    // If the chip is already configured in a different mode, stop
@@ -1606,7 +1618,8 @@ WifiStatus WifiChip::registerRadioModeChangeCallback() {
    return createWifiStatusFromLegacyError(legacy_status);
}

std::vector<V1_4::IWifiChip::ChipIfaceCombination> WifiChip::getCurrentModeIfaceCombinations() {
std::vector<V1_6::IWifiChip::ChipConcurrencyCombination>
WifiChip::getCurrentModeConcurrencyCombinations() {
    if (!isValidModeId(current_mode_id_)) {
        LOG(ERROR) << "Chip not configured in a mode yet";
        return {};
@@ -1616,27 +1629,39 @@ std::vector<V1_4::IWifiChip::ChipIfaceCombination> WifiChip::getCurrentModeIface
            return mode.availableCombinations;
        }
    }
    CHECK(0) << "Expected to find iface combinations for current mode!";
    CHECK(0) << "Expected to find concurrency combinations for current mode!";
    return {};
}

// Returns a map indexed by IfaceType with the number of ifaces currently
// created of the corresponding type.
std::map<IfaceType, size_t> WifiChip::getCurrentIfaceCombination() {
    std::map<IfaceType, size_t> iface_counts;
    iface_counts[IfaceType::AP] = ap_ifaces_.size();
    iface_counts[IfaceType::NAN] = nan_ifaces_.size();
    iface_counts[IfaceType::P2P] = p2p_ifaces_.size();
    iface_counts[IfaceType::STA] = sta_ifaces_.size();
// Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently
// created of the corresponding concurrency type.
std::map<IfaceConcurrencyType, size_t> WifiChip::getCurrentConcurrencyCombination() {
    std::map<IfaceConcurrencyType, size_t> iface_counts;
    uint32_t num_ap = 0;
    uint32_t num_ap_bridged = 0;
    for (const auto& ap_iface : ap_ifaces_) {
        std::string ap_iface_name = ap_iface->getName();
        if (br_ifaces_ap_instances_.count(ap_iface_name) > 0 &&
            br_ifaces_ap_instances_[ap_iface_name].size() > 1) {
            num_ap_bridged++;
        } else {
            num_ap++;
        }
    }
    iface_counts[IfaceConcurrencyType::AP] = num_ap;
    iface_counts[IfaceConcurrencyType::AP_BRIDGED] = num_ap_bridged;
    iface_counts[IfaceConcurrencyType::NAN] = nan_ifaces_.size();
    iface_counts[IfaceConcurrencyType::P2P] = p2p_ifaces_.size();
    iface_counts[IfaceConcurrencyType::STA] = sta_ifaces_.size();
    return iface_counts;
}

// This expands the provided iface combinations to a more parseable
// This expands the provided concurrency combinations to a more parseable
// form. Returns a vector of available combinations possible with the number
// of ifaces of each type in the combination.
// This method is a port of HalDeviceManager.expandIfaceCombos() from framework.
std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations(
        const V1_4::IWifiChip::ChipIfaceCombination& combination) {
// of each concurrency type in the combination.
// This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework.
std::vector<std::map<IfaceConcurrencyType, size_t>> WifiChip::expandConcurrencyCombinations(
        const V1_6::IWifiChip::ChipConcurrencyCombination& combination) {
    uint32_t num_expanded_combos = 1;
    for (const auto& limit : combination.limits) {
        for (uint32_t i = 0; i < limit.maxIfaces; i++) {
@@ -1644,12 +1669,14 @@ std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations(
        }
    }

    // Allocate the vector of expanded combos and reset all iface counts to 0
    // Allocate the vector of expanded combos and reset all concurrency type counts to 0
    // in each combo.
    std::vector<std::map<IfaceType, size_t>> expanded_combos;
    std::vector<std::map<IfaceConcurrencyType, size_t>> expanded_combos;
    expanded_combos.resize(num_expanded_combos);
    for (auto& expanded_combo : expanded_combos) {
        for (const auto type : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
        for (const auto type :
             {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN,
              IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) {
            expanded_combo[type] = 0;
        }
    }
@@ -1666,12 +1693,15 @@ std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations(
    return expanded_combos;
}

bool WifiChip::canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(
        const std::map<IfaceType, size_t>& expanded_combo, IfaceType requested_type) {
    const auto current_combo = getCurrentIfaceCombination();
bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(
        const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
        IfaceConcurrencyType requested_type) {
    const auto current_combo = getCurrentConcurrencyCombination();

    // Check if we have space for 1 more iface of |type| in this combo
    for (const auto type : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
    for (const auto type :
         {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN,
          IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) {
        size_t num_ifaces_needed = current_combo.at(type);
        if (type == requested_type) {
            num_ifaces_needed++;
@@ -1685,20 +1715,21 @@ bool WifiChip::canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(
}

// This method does the following:
// a) Enumerate all possible iface combos by expanding the current
//    ChipIfaceCombination.
// b) Check if the requested iface type can be added to the current mode
//    with the iface combination that is already active.
bool WifiChip::canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType requested_type) {
// a) Enumerate all possible concurrency combos by expanding the current
//    ChipConcurrencyCombination.
// b) Check if the requested concurrency type can be added to the current mode
//    with the concurrency combination that is already active.
bool WifiChip::canCurrentModeSupportConcurrencyTypeWithCurrentTypes(
        IfaceConcurrencyType requested_type) {
    if (!isValidModeId(current_mode_id_)) {
        LOG(ERROR) << "Chip not configured in a mode yet";
        return false;
    }
    const auto combinations = getCurrentModeIfaceCombinations();
    const auto combinations = getCurrentModeConcurrencyCombinations();
    for (const auto& combination : combinations) {
        const auto expanded_combos = expandIfaceCombinations(combination);
        const auto expanded_combos = expandConcurrencyCombinations(combination);
        for (const auto& expanded_combo : expanded_combos) {
            if (canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(expanded_combo,
            if (canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(expanded_combo,
                                                                                  requested_type)) {
                return true;
            }
@@ -1707,15 +1738,17 @@ bool WifiChip::canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType reque
    return false;
}

// Note: This does not consider ifaces already active. It only checks if the
// provided expanded iface combination can support the requested combo.
bool WifiChip::canExpandedIfaceComboSupportIfaceCombo(
        const std::map<IfaceType, size_t>& expanded_combo,
        const std::map<IfaceType, size_t>& req_combo) {
    // Check if we have space for 1 more iface of |type| in this combo
    for (const auto type : {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) {
// Note: This does not consider concurrency types already active. It only checks if the
// provided expanded concurrency combination can support the requested combo.
bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo(
        const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
        const std::map<IfaceConcurrencyType, size_t>& req_combo) {
    // Check if we have space for 1 more |type| in this combo
    for (const auto type :
         {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN,
          IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) {
        if (req_combo.count(type) == 0) {
            // Iface of "type" not in the req_combo.
            // Concurrency type not in the req_combo.
            continue;
        }
        size_t num_ifaces_needed = req_combo.at(type);
@@ -1727,21 +1760,22 @@ bool WifiChip::canExpandedIfaceComboSupportIfaceCombo(
    return true;
}
// This method does the following:
// a) Enumerate all possible iface combos by expanding the current
//    ChipIfaceCombination.
// b) Check if the requested iface combo can be added to the current mode.
// Note: This does not consider ifaces already active. It only checks if the
// a) Enumerate all possible concurrency combos by expanding the current
//    ChipConcurrencyCombination.
// b) Check if the requested concurrency combo can be added to the current mode.
// Note: This does not consider concurrency types already active. It only checks if the
// current mode can support the requested combo.
bool WifiChip::canCurrentModeSupportIfaceCombo(const std::map<IfaceType, size_t>& req_combo) {
bool WifiChip::canCurrentModeSupportConcurrencyCombo(
        const std::map<IfaceConcurrencyType, size_t>& req_combo) {
    if (!isValidModeId(current_mode_id_)) {
        LOG(ERROR) << "Chip not configured in a mode yet";
        return false;
    }
    const auto combinations = getCurrentModeIfaceCombinations();
    const auto combinations = getCurrentModeConcurrencyCombinations();
    for (const auto& combination : combinations) {
        const auto expanded_combos = expandIfaceCombinations(combination);
        const auto expanded_combos = expandConcurrencyCombinations(combination);
        for (const auto& expanded_combo : expanded_combos) {
            if (canExpandedIfaceComboSupportIfaceCombo(expanded_combo, req_combo)) {
            if (canExpandedConcurrencyComboSupportConcurrencyCombo(expanded_combo, req_combo)) {
                return true;
            }
        }
@@ -1750,14 +1784,14 @@ bool WifiChip::canCurrentModeSupportIfaceCombo(const std::map<IfaceType, size_t>
}

// This method does the following:
// a) Enumerate all possible iface combos by expanding the current
//    ChipIfaceCombination.
// b) Check if the requested iface type can be added to the current mode.
bool WifiChip::canCurrentModeSupportIfaceOfType(IfaceType requested_type) {
    // Check if we can support at least 1 iface of type.
    std::map<IfaceType, size_t> req_iface_combo;
// a) Enumerate all possible concurrency combos by expanding the current
//    ChipConcurrencyCombination.
// b) Check if the requested concurrency type can be added to the current mode.
bool WifiChip::canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type) {
    // Check if we can support at least 1 of the requested concurrency type.
    std::map<IfaceConcurrencyType, size_t> req_iface_combo;
    req_iface_combo[requested_type] = 1;
    return canCurrentModeSupportIfaceCombo(req_iface_combo);
    return canCurrentModeSupportConcurrencyCombo(req_iface_combo);
}

bool WifiChip::isValidModeId(ChipModeId mode_id) {
@@ -1771,17 +1805,17 @@ bool WifiChip::isValidModeId(ChipModeId mode_id) {

bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() {
    // Check if we can support at least 1 STA & 1 AP concurrently.
    std::map<IfaceType, size_t> req_iface_combo;
    req_iface_combo[IfaceType::AP] = 1;
    req_iface_combo[IfaceType::STA] = 1;
    return canCurrentModeSupportIfaceCombo(req_iface_combo);
    std::map<IfaceConcurrencyType, size_t> req_iface_combo;
    req_iface_combo[IfaceConcurrencyType::STA] = 1;
    req_iface_combo[IfaceConcurrencyType::AP] = 1;
    return canCurrentModeSupportConcurrencyCombo(req_iface_combo);
}

bool WifiChip::isDualStaConcurrencyAllowedInCurrentMode() {
    // Check if we can support at least 2 STA concurrently.
    std::map<IfaceType, size_t> req_iface_combo;
    req_iface_combo[IfaceType::STA] = 2;
    return canCurrentModeSupportIfaceCombo(req_iface_combo);
    std::map<IfaceConcurrencyType, size_t> req_iface_combo;
    req_iface_combo[IfaceConcurrencyType::STA] = 2;
    return canCurrentModeSupportConcurrencyCombo(req_iface_combo);
}

std::string WifiChip::getFirstActiveWlanIfaceName() {
+24 −13
Original line number Diff line number Diff line
@@ -17,6 +17,11 @@
#ifndef WIFI_CHIP_H_
#define WIFI_CHIP_H_

// HACK: NAN is a macro defined in math.h, which can be included in various
// headers. This wifi HAL uses an enum called NAN, which does not compile when
// the macro is defined. Undefine NAN to work around it.
#undef NAN

#include <list>
#include <map>
#include <mutex>
@@ -162,6 +167,7 @@ class WifiChip : public V1_6::IWifiChip {
                                       getUsableChannels_1_6_cb _hidl_cb) override;
    Return<void> getSupportedRadioCombinationsMatrix(
            getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override;
    Return<void> getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) override;

  private:
    void invalidateAndRemoveAllIfaces();
@@ -175,7 +181,7 @@ class WifiChip : public V1_6::IWifiChip {
    WifiStatus registerEventCallbackInternal(
            const sp<V1_0::IWifiChipEventCallback>& event_callback);
    std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
    std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal();
    std::pair<WifiStatus, std::vector<V1_0::IWifiChip::ChipMode>> getAvailableModesInternal();
    WifiStatus configureChipInternal(std::unique_lock<std::recursive_mutex>* lock,
                                     ChipModeId mode_id);
    std::pair<WifiStatus, uint32_t> getModeInternal();
@@ -239,17 +245,21 @@ class WifiChip : public V1_6::IWifiChip {
                                       ChipModeId mode_id);
    WifiStatus registerDebugRingBufferCallback();
    WifiStatus registerRadioModeChangeCallback();
    std::vector<V1_4::IWifiChip::ChipIfaceCombination> getCurrentModeIfaceCombinations();
    std::map<IfaceType, size_t> getCurrentIfaceCombination();
    std::vector<std::map<IfaceType, size_t>> expandIfaceCombinations(
            const V1_4::IWifiChip::ChipIfaceCombination& combination);
    bool canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces(
            const std::map<IfaceType, size_t>& expanded_combo, IfaceType requested_type);
    bool canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType requested_type);
    bool canExpandedIfaceComboSupportIfaceCombo(const std::map<IfaceType, size_t>& expanded_combo,
                                                const std::map<IfaceType, size_t>& req_combo);
    bool canCurrentModeSupportIfaceCombo(const std::map<IfaceType, size_t>& req_combo);
    bool canCurrentModeSupportIfaceOfType(IfaceType requested_type);
    std::vector<V1_6::IWifiChip::ChipConcurrencyCombination>
    getCurrentModeConcurrencyCombinations();
    std::map<IfaceConcurrencyType, size_t> getCurrentConcurrencyCombination();
    std::vector<std::map<IfaceConcurrencyType, size_t>> expandConcurrencyCombinations(
            const V1_6::IWifiChip::ChipConcurrencyCombination& combination);
    bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(
            const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
            IfaceConcurrencyType requested_type);
    bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type);
    bool canExpandedConcurrencyComboSupportConcurrencyCombo(
            const std::map<IfaceConcurrencyType, size_t>& expanded_combo,
            const std::map<IfaceConcurrencyType, size_t>& req_combo);
    bool canCurrentModeSupportConcurrencyCombo(
            const std::map<IfaceConcurrencyType, size_t>& req_combo);
    bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type);
    bool isValidModeId(ChipModeId mode_id);
    bool isStaApConcurrencyAllowedInCurrentMode();
    bool isDualStaConcurrencyAllowedInCurrentMode();
@@ -270,6 +280,7 @@ class WifiChip : public V1_6::IWifiChip {
    std::pair<WifiStatus, std::vector<V1_6::WifiUsableChannel>> getUsableChannelsInternal_1_6(
            WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask);
    std::pair<WifiStatus, WifiRadioCombinationMatrix> getSupportedRadioCombinationsMatrixInternal();
    std::pair<WifiStatus, std::vector<V1_6::IWifiChip::ChipMode>> getAvailableModesInternal_1_6();

    ChipId chip_id_;
    std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
@@ -285,7 +296,7 @@ class WifiChip : public V1_6::IWifiChip {
    // Members pertaining to chip configuration.
    uint32_t current_mode_id_;
    std::mutex lock_t;
    std::vector<V1_4::IWifiChip::ChipMode> modes_;
    std::vector<V1_6::IWifiChip::ChipMode> modes_;
    // The legacy ring buffer callback API has only a global callback
    // registration mechanism. Use this to check if we have already
    // registered a callback.
Loading