diff options
-rw-r--r-- | camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc | 2 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_chip.cpp | 47 | ||||
-rw-r--r-- | wifi/1.2/default/wifi_chip.h | 2 |
3 files changed, 26 insertions, 25 deletions
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc index c9196284ee..ee26d133b5 100644 --- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc +++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc @@ -4,4 +4,4 @@ service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provid group audio camera input drmrpc ioprio rt 4 capabilities SYS_NICE - writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks + writepid /dev/cpuset/camera-daemon/tasks /dev/stune/foreground/tasks diff --git a/wifi/1.2/default/wifi_chip.cpp b/wifi/1.2/default/wifi_chip.cpp index 272520704e..1f15fe475c 100644 --- a/wifi/1.2/default/wifi_chip.cpp +++ b/wifi/1.2/default/wifi_chip.cpp @@ -598,6 +598,7 @@ void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearAll(p2p_ifaces_); invalidateAndClearAll(sta_ifaces_); invalidateAndClearAll(created_ap_ifaces_); + invalidateAndClearAll(created_sta_ifaces_); // Since all the ifaces are invalid now, all RTT controller objects // using those ifaces also need to be invalidated. for (const auto& rtt : rtt_controllers_) { @@ -747,13 +748,8 @@ std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } - std::string ifname = ""; bool iface_created = false; - if (feature_flags_.lock()->isDualInterfaceSupported()) - ifname = qcAllocateApIfaceName(); - else - ifname = allocateApOrStaIfaceName(); - + std::string ifname = allocateApOrStaIfaceName(); if (!if_nametoindex(ifname.c_str())) { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->QcAddInterface(getWlan0IfaceName(), ifname, @@ -914,9 +910,22 @@ std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() { if (!canCurrentModeSupportIfaceOfType(IfaceType::STA)) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } + bool iface_created = false; std::string ifname = allocateApOrStaIfaceName(); + if (!if_nametoindex(ifname.c_str())) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcAddInterface(getWlan0IfaceName(), ifname, + (uint32_t)IfaceType::STA); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to add interface: " << ifname << " " + << legacyErrorToString(legacy_status); + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + iface_created = true; + } sp<WifiStaIface> iface = new WifiStaIface(ifname, legacy_hal_); sta_ifaces_.push_back(iface); + if (iface_created) created_sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; @@ -947,6 +956,15 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } + if (findUsingName(created_sta_ifaces_, ifname) != nullptr) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->QcRemoveInterface(getWlan0IfaceName(), ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to remove interface: " << ifname << " " + << legacyErrorToString(legacy_status); + } + invalidateAndClear(created_sta_ifaces_, iface); + } invalidateAndClear(sta_ifaces_, iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) { @@ -1428,23 +1446,6 @@ std::string WifiChip::allocateApOrStaIfaceName() { return {}; } -// Return "wlan1", if "wlan1" is not already in use, else return "wlan0". -// This is based on the assumption that we'll have a max of 2 concurrent -// AP ifaces. -std::string WifiChip::qcAllocateApIfaceName() { - auto ap_iface = findUsingName(ap_ifaces_, getWlan1IfaceName()); - if (!ap_iface.get()) { - return getWlan1IfaceName(); - } - ap_iface = findUsingName(ap_ifaces_, getWlan0IfaceName()); - if (!ap_iface.get()) { - return getWlan0IfaceName(); - } - // This should never happen. We screwed up somewhere if it did. - CHECK(0) << "wlan0 and wlan1 in use already!"; - return {}; -} - bool WifiChip::writeRingbufferFilesInternal() { if (!removeOldFilesInternal()) { LOG(ERROR) << "Error occurred while deleting old tombstone files"; diff --git a/wifi/1.2/default/wifi_chip.h b/wifi/1.2/default/wifi_chip.h index 94e55e8230..2308747754 100644 --- a/wifi/1.2/default/wifi_chip.h +++ b/wifi/1.2/default/wifi_chip.h @@ -216,7 +216,6 @@ class WifiChip : public V1_2::IWifiChip { bool canCurrentModeSupportIfaceOfType(IfaceType type); bool isValidModeId(ChipModeId mode_id); std::string allocateApOrStaIfaceName(); - std::string qcAllocateApIfaceName(); bool writeRingbufferFilesInternal(); ChipId chip_id_; @@ -241,6 +240,7 @@ class WifiChip : public V1_2::IWifiChip { event_cb_handler_; std::vector<sp<WifiApIface>> created_ap_ifaces_; + std::vector<sp<WifiStaIface>> created_sta_ifaces_; DISALLOW_COPY_AND_ASSIGN(WifiChip); }; |