summaryrefslogtreecommitdiffstats
path: root/wifi/1.3/default/wifi_chip.cpp
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-04-19 08:41:20 -0700
committerRoshan Pius <rpius@google.com>2019-04-22 08:58:46 -0700
commit444473fbc083355c978ceb0476de56fc3af16f4c (patch)
treeb1847db12886d74940a370b49dc9788c49347cf6 /wifi/1.3/default/wifi_chip.cpp
parent014dd02f6e6c842f2f6e23c9b79be8f0f95e5c87 (diff)
downloadandroid_hardware_interfaces-444473fbc083355c978ceb0476de56fc3af16f4c.tar.gz
android_hardware_interfaces-444473fbc083355c978ceb0476de56fc3af16f4c.tar.bz2
android_hardware_interfaces-444473fbc083355c978ceb0476de56fc3af16f4c.zip
wifi(implementation): Simplify getFirstActiveWlanIfaceName
Get rid of the unnecessary looping inside the method which was causing a bunch of unnecessary selinux denial logs. Bug: 130384921 Test: ./data/android.hardware.wifi@1.0-service-tests Test: Manually verified the property name after wifi on/off & softap on/off. Change-Id: Ia9f61749b2017234851d67b027deb685cb8b539e
Diffstat (limited to 'wifi/1.3/default/wifi_chip.cpp')
-rw-r--r--wifi/1.3/default/wifi_chip.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp
index 25eb28983..b768959f2 100644
--- a/wifi/1.3/default/wifi_chip.cpp
+++ b/wifi/1.3/default/wifi_chip.cpp
@@ -1436,14 +1436,11 @@ bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() {
}
std::string WifiChip::getFirstActiveWlanIfaceName() {
- for (unsigned idx = 0; idx < kMaxWlanIfaces; idx++) {
- const auto ifname = getWlanIfaceName(idx);
- if (findUsingName(sta_ifaces_, ifname)) return ifname;
- if (findUsingName(ap_ifaces_, ifname)) return ifname;
- }
+ if (sta_ifaces_.size() > 0) return sta_ifaces_[0]->getName();
+ if (ap_ifaces_.size() > 0) return ap_ifaces_[0]->getName();
// This could happen if the chip call is made before any STA/AP
// iface is created. Default to wlan0 for such cases.
- LOG(WARNING) << "No active wlan interfaces in use!";
+ LOG(WARNING) << "No active wlan interfaces in use! Using default";
return getWlanIfaceName(0);
}