Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 17 | #include <fcntl.h> |
| 18 | |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 19 | #include <android-base/logging.h> |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 20 | #include <android-base/unique_fd.h> |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 21 | #include <cutils/properties.h> |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 22 | #include <sys/stat.h> |
| 23 | #include <sys/sysmacros.h> |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 24 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 25 | #include "hidl_return_util.h" |
Roshan Pius | e2d0ab5 | 2016-12-05 15:24:20 -0800 | [diff] [blame] | 26 | #include "hidl_struct_util.h" |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 27 | #include "wifi_chip.h" |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 28 | #include "wifi_status_util.h" |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 29 | |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 30 | namespace { |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 31 | using android::sp; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 32 | using android::base::unique_fd; |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 33 | using android::hardware::hidl_string; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 34 | using android::hardware::hidl_vec; |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 35 | using android::hardware::wifi::V1_0::ChipModeId; |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 36 | using android::hardware::wifi::V1_0::IfaceType; |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 37 | using android::hardware::wifi::V1_0::IWifiChip; |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 38 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 39 | constexpr char kCpioMagic[] = "070701"; |
Roger Wang | b294c76 | 2018-11-02 15:34:39 +0800 | [diff] [blame] | 40 | constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; |
| 41 | constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 42 | constexpr uint32_t kMaxRingBufferFileNum = 20; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 43 | constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 44 | constexpr char kActiveWlanIfaceNameProperty[] = "wifi.active.interface"; |
| 45 | constexpr char kNoActiveWlanIfaceNamePropertyValue[] = ""; |
| 46 | constexpr unsigned kMaxWlanIfaces = 5; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 47 | |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 48 | template <typename Iface> |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 49 | void invalidateAndClear(std::vector<sp<Iface>>& ifaces, sp<Iface> iface) { |
| 50 | iface->invalidate(); |
| 51 | ifaces.erase(std::remove(ifaces.begin(), ifaces.end(), iface), |
| 52 | ifaces.end()); |
| 53 | } |
| 54 | |
| 55 | template <typename Iface> |
| 56 | void invalidateAndClearAll(std::vector<sp<Iface>>& ifaces) { |
| 57 | for (const auto& iface : ifaces) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 58 | iface->invalidate(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 59 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 60 | ifaces.clear(); |
| 61 | } |
| 62 | |
| 63 | template <typename Iface> |
| 64 | std::vector<hidl_string> getNames(std::vector<sp<Iface>>& ifaces) { |
| 65 | std::vector<hidl_string> names; |
| 66 | for (const auto& iface : ifaces) { |
| 67 | names.emplace_back(iface->getName()); |
| 68 | } |
| 69 | return names; |
| 70 | } |
| 71 | |
| 72 | template <typename Iface> |
| 73 | sp<Iface> findUsingName(std::vector<sp<Iface>>& ifaces, |
| 74 | const std::string& name) { |
| 75 | std::vector<hidl_string> names; |
| 76 | for (const auto& iface : ifaces) { |
| 77 | if (name == iface->getName()) { |
| 78 | return iface; |
| 79 | } |
| 80 | } |
| 81 | return nullptr; |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 82 | } |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 83 | |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 84 | std::string getWlanIfaceName(unsigned idx) { |
| 85 | if (idx >= kMaxWlanIfaces) { |
| 86 | CHECK(false) << "Requested interface beyond wlan" << kMaxWlanIfaces; |
| 87 | return {}; |
| 88 | } |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 89 | |
Roshan Pius | 8e3c7ef | 2017-11-03 09:43:08 -0700 | [diff] [blame] | 90 | std::array<char, PROPERTY_VALUE_MAX> buffer; |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 91 | if (idx == 0 || idx == 1) { |
| 92 | const char* altPropName = |
| 93 | (idx == 0) ? "wifi.interface" : "wifi.concurrent.interface"; |
Roshan Pius | 5b33346 | 2019-03-01 14:07:22 -0800 | [diff] [blame] | 94 | auto res = property_get(altPropName, buffer.data(), nullptr); |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 95 | if (res > 0) return buffer.data(); |
| 96 | } |
Roshan Pius | 5b33346 | 2019-03-01 14:07:22 -0800 | [diff] [blame] | 97 | std::string propName = "wifi.interface." + std::to_string(idx); |
| 98 | auto res = property_get(propName.c_str(), buffer.data(), nullptr); |
| 99 | if (res > 0) return buffer.data(); |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 100 | |
| 101 | return "wlan" + std::to_string(idx); |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 102 | } |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 103 | |
| 104 | std::string getP2pIfaceName() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 105 | std::array<char, PROPERTY_VALUE_MAX> buffer; |
| 106 | property_get("wifi.direct.interface", buffer.data(), "p2p0"); |
| 107 | return buffer.data(); |
Roshan Pius | 9377a0d | 2017-10-06 13:18:54 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Roshan Pius | 5ba0a90 | 2020-04-14 11:55:42 -0700 | [diff] [blame] | 110 | // Returns the dedicated iface name if one is defined. |
| 111 | std::string getNanIfaceName() { |
| 112 | std::array<char, PROPERTY_VALUE_MAX> buffer; |
| 113 | if (property_get("wifi.aware.interface", buffer.data(), nullptr) == 0) { |
| 114 | return {}; |
| 115 | } |
| 116 | return buffer.data(); |
| 117 | } |
| 118 | |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 119 | void setActiveWlanIfaceNameProperty(const std::string& ifname) { |
| 120 | auto res = property_set(kActiveWlanIfaceNameProperty, ifname.data()); |
| 121 | if (res != 0) { |
| 122 | PLOG(ERROR) << "Failed to set active wlan iface name property"; |
| 123 | } |
| 124 | } |
| 125 | |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 126 | // delete files that meet either conditions: |
| 127 | // 1. older than a predefined time in the wifi tombstone dir. |
| 128 | // 2. Files in excess to a predefined amount, starting from the oldest ones |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 129 | bool removeOldFilesInternal() { |
| 130 | time_t now = time(0); |
| 131 | const time_t delete_files_before = now - kMaxRingBufferFileAgeSeconds; |
Josh Gao | a568e53 | 2018-06-04 18:16:00 -0700 | [diff] [blame] | 132 | std::unique_ptr<DIR, decltype(&closedir)> dir_dump( |
| 133 | opendir(kTombstoneFolderPath), closedir); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 134 | if (!dir_dump) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 135 | PLOG(ERROR) << "Failed to open directory"; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 136 | return false; |
| 137 | } |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 138 | struct dirent* dp; |
| 139 | bool success = true; |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 140 | std::list<std::pair<const time_t, std::string>> valid_files; |
Josh Gao | a568e53 | 2018-06-04 18:16:00 -0700 | [diff] [blame] | 141 | while ((dp = readdir(dir_dump.get()))) { |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 142 | if (dp->d_type != DT_REG) { |
| 143 | continue; |
| 144 | } |
| 145 | std::string cur_file_name(dp->d_name); |
| 146 | struct stat cur_file_stat; |
| 147 | std::string cur_file_path = kTombstoneFolderPath + cur_file_name; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 148 | if (stat(cur_file_path.c_str(), &cur_file_stat) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 149 | PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 150 | success = false; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 151 | continue; |
| 152 | } |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 153 | const time_t cur_file_time = cur_file_stat.st_mtime; |
| 154 | valid_files.push_back( |
| 155 | std::pair<const time_t, std::string>(cur_file_time, cur_file_path)); |
| 156 | } |
| 157 | valid_files.sort(); // sort the list of files by last modified time from |
| 158 | // small to big. |
| 159 | uint32_t cur_file_count = valid_files.size(); |
| 160 | for (auto cur_file : valid_files) { |
| 161 | if (cur_file_count > kMaxRingBufferFileNum || |
| 162 | cur_file.first < delete_files_before) { |
| 163 | if (unlink(cur_file.second.c_str()) != 0) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 164 | PLOG(ERROR) << "Error deleting file"; |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 165 | success = false; |
| 166 | } |
| 167 | cur_file_count--; |
| 168 | } else { |
| 169 | break; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | return success; |
| 173 | } |
| 174 | |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 175 | // Helper function for |cpioArchiveFilesInDir| |
| 176 | bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, |
| 177 | size_t file_name_len) { |
| 178 | std::array<char, 32 * 1024> read_buf; |
| 179 | ssize_t llen = |
| 180 | sprintf(read_buf.data(), |
| 181 | "%s%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", |
| 182 | kCpioMagic, static_cast<int>(st.st_ino), st.st_mode, st.st_uid, |
| 183 | st.st_gid, static_cast<int>(st.st_nlink), |
| 184 | static_cast<int>(st.st_mtime), static_cast<int>(st.st_size), |
| 185 | major(st.st_dev), minor(st.st_dev), major(st.st_rdev), |
| 186 | minor(st.st_rdev), static_cast<uint32_t>(file_name_len), 0); |
| 187 | if (write(out_fd, read_buf.data(), llen) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 188 | PLOG(ERROR) << "Error writing cpio header to file " << file_name; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 189 | return false; |
| 190 | } |
| 191 | if (write(out_fd, file_name, file_name_len) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 192 | PLOG(ERROR) << "Error writing filename to file " << file_name; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 193 | return false; |
| 194 | } |
| 195 | |
| 196 | // NUL Pad header up to 4 multiple bytes. |
| 197 | llen = (llen + file_name_len) % 4; |
| 198 | if (llen != 0) { |
| 199 | const uint32_t zero = 0; |
| 200 | if (write(out_fd, &zero, 4 - llen) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 201 | PLOG(ERROR) << "Error padding 0s to file " << file_name; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 202 | return false; |
| 203 | } |
| 204 | } |
| 205 | return true; |
| 206 | } |
| 207 | |
| 208 | // Helper function for |cpioArchiveFilesInDir| |
| 209 | size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { |
| 210 | // writing content of file |
| 211 | std::array<char, 32 * 1024> read_buf; |
| 212 | ssize_t llen = st.st_size; |
| 213 | size_t n_error = 0; |
| 214 | while (llen > 0) { |
| 215 | ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); |
| 216 | if (bytes_read == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 217 | PLOG(ERROR) << "Error reading file"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 218 | return ++n_error; |
| 219 | } |
| 220 | llen -= bytes_read; |
| 221 | if (write(out_fd, read_buf.data(), bytes_read) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 222 | PLOG(ERROR) << "Error writing data to file"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 223 | return ++n_error; |
| 224 | } |
| 225 | if (bytes_read == 0) { // this should never happen, but just in case |
| 226 | // to unstuck from while loop |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 227 | PLOG(ERROR) << "Unexpected read result"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 228 | n_error++; |
| 229 | break; |
| 230 | } |
| 231 | } |
| 232 | llen = st.st_size % 4; |
| 233 | if (llen != 0) { |
| 234 | const uint32_t zero = 0; |
| 235 | if (write(out_fd, &zero, 4 - llen) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 236 | PLOG(ERROR) << "Error padding 0s to file"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 237 | return ++n_error; |
| 238 | } |
| 239 | } |
| 240 | return n_error; |
| 241 | } |
| 242 | |
| 243 | // Helper function for |cpioArchiveFilesInDir| |
| 244 | bool cpioWriteFileTrailer(int out_fd) { |
| 245 | std::array<char, 4096> read_buf; |
| 246 | read_buf.fill(0); |
| 247 | if (write(out_fd, read_buf.data(), |
| 248 | sprintf(read_buf.data(), "070701%040X%056X%08XTRAILER!!!", 1, |
| 249 | 0x0b, 0) + |
| 250 | 4) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 251 | PLOG(ERROR) << "Error writing trailing bytes"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 252 | return false; |
| 253 | } |
| 254 | return true; |
| 255 | } |
| 256 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 257 | // Archives all files in |input_dir| and writes result into |out_fd| |
| 258 | // Logic obtained from //external/toybox/toys/posix/cpio.c "Output cpio archive" |
| 259 | // portion |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 260 | size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 261 | struct dirent* dp; |
| 262 | size_t n_error = 0; |
Josh Gao | a568e53 | 2018-06-04 18:16:00 -0700 | [diff] [blame] | 263 | std::unique_ptr<DIR, decltype(&closedir)> dir_dump(opendir(input_dir), |
| 264 | closedir); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 265 | if (!dir_dump) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 266 | PLOG(ERROR) << "Failed to open directory"; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 267 | return ++n_error; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 268 | } |
Josh Gao | a568e53 | 2018-06-04 18:16:00 -0700 | [diff] [blame] | 269 | while ((dp = readdir(dir_dump.get()))) { |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 270 | if (dp->d_type != DT_REG) { |
| 271 | continue; |
| 272 | } |
| 273 | std::string cur_file_name(dp->d_name); |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 274 | // string.size() does not include the null terminator. The cpio FreeBSD |
| 275 | // file header expects the null character to be included in the length. |
| 276 | const size_t file_name_len = cur_file_name.size() + 1; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 277 | struct stat st; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 278 | const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 279 | if (stat(cur_file_path.c_str(), &st) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 280 | PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 281 | n_error++; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 282 | continue; |
| 283 | } |
| 284 | const int fd_read = open(cur_file_path.c_str(), O_RDONLY); |
| 285 | if (fd_read == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 286 | PLOG(ERROR) << "Failed to open file " << cur_file_path; |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 287 | n_error++; |
| 288 | continue; |
| 289 | } |
| 290 | unique_fd file_auto_closer(fd_read); |
| 291 | if (!cpioWriteHeader(out_fd, st, cur_file_name.c_str(), |
| 292 | file_name_len)) { |
| 293 | return ++n_error; |
| 294 | } |
| 295 | size_t write_error = cpioWriteFileContent(fd_read, out_fd, st); |
| 296 | if (write_error) { |
| 297 | return n_error + write_error; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 298 | } |
| 299 | } |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 300 | if (!cpioWriteFileTrailer(out_fd)) { |
| 301 | return ++n_error; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 302 | } |
| 303 | return n_error; |
| 304 | } |
| 305 | |
| 306 | // Helper function to create a non-const char*. |
| 307 | std::vector<char> makeCharVec(const std::string& str) { |
| 308 | std::vector<char> vec(str.size() + 1); |
| 309 | vec.assign(str.begin(), str.end()); |
| 310 | vec.push_back('\0'); |
| 311 | return vec; |
| 312 | } |
| 313 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 314 | } // namespace |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 315 | |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 316 | namespace android { |
| 317 | namespace hardware { |
| 318 | namespace wifi { |
Ahmed ElArabawy | f501a98 | 2019-07-23 15:02:22 -0700 | [diff] [blame] | 319 | namespace V1_4 { |
Roshan Pius | 79a9975 | 2016-10-04 13:03:58 -0700 | [diff] [blame] | 320 | namespace implementation { |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 321 | using hidl_return_util::validateAndCall; |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 322 | using hidl_return_util::validateAndCallWithLock; |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 323 | |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 324 | WifiChip::WifiChip( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 325 | ChipId chip_id, const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal, |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 326 | const std::weak_ptr<mode_controller::WifiModeController> mode_controller, |
Roshan Pius | 99dab38 | 2019-02-14 07:57:10 -0800 | [diff] [blame] | 327 | const std::weak_ptr<iface_util::WifiIfaceUtil> iface_util, |
Roshan Pius | 200a17d | 2017-11-01 13:03:35 -0700 | [diff] [blame] | 328 | const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags) |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 329 | : chip_id_(chip_id), |
| 330 | legacy_hal_(legacy_hal), |
| 331 | mode_controller_(mode_controller), |
Roshan Pius | 99dab38 | 2019-02-14 07:57:10 -0800 | [diff] [blame] | 332 | iface_util_(iface_util), |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 333 | is_valid_(true), |
Tomasz Wasilczyk | b424da7 | 2018-11-15 11:52:57 -0800 | [diff] [blame] | 334 | current_mode_id_(feature_flags::chip_mode_ids::kInvalid), |
| 335 | modes_(feature_flags.lock()->getChipModes()), |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 336 | debug_ring_buffer_cb_registered_(false) { |
| 337 | setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); |
| 338 | } |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 339 | |
Roshan Pius | aabe575 | 2016-09-29 09:03:59 -0700 | [diff] [blame] | 340 | void WifiChip::invalidate() { |
xshu | 37126c9 | 2018-04-13 16:24:45 -0700 | [diff] [blame] | 341 | if (!writeRingbufferFilesInternal()) { |
| 342 | LOG(ERROR) << "Error writing files to flash"; |
| 343 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 344 | invalidateAndRemoveAllIfaces(); |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 345 | setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 346 | legacy_hal_.reset(); |
| 347 | event_cb_handler_.invalidate(); |
| 348 | is_valid_ = false; |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 349 | } |
| 350 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 351 | bool WifiChip::isValid() { return is_valid_; } |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 352 | |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 353 | std::set<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 354 | return event_cb_handler_.getCallbacks(); |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 355 | } |
| 356 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 357 | Return<void> WifiChip::getId(getId_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 358 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 359 | &WifiChip::getIdInternal, hidl_status_cb); |
Roshan Pius | cd566bd | 2016-10-10 08:03:42 -0700 | [diff] [blame] | 360 | } |
| 361 | |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 362 | // Deprecated support for this callback |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 363 | Return<void> WifiChip::registerEventCallback( |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 364 | const sp<V1_0::IWifiChipEventCallback>& event_callback, |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 365 | registerEventCallback_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 366 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 367 | &WifiChip::registerEventCallbackInternal, |
| 368 | hidl_status_cb, event_callback); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 369 | } |
| 370 | |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 371 | Return<void> WifiChip::getCapabilities(getCapabilities_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 372 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 373 | &WifiChip::getCapabilitiesInternal, hidl_status_cb); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 374 | } |
| 375 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 376 | Return<void> WifiChip::getAvailableModes(getAvailableModes_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 377 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 378 | &WifiChip::getAvailableModesInternal, |
| 379 | hidl_status_cb); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 380 | } |
| 381 | |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 382 | Return<void> WifiChip::configureChip(ChipModeId mode_id, |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 383 | configureChip_cb hidl_status_cb) { |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 384 | return validateAndCallWithLock( |
| 385 | this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 386 | &WifiChip::configureChipInternal, hidl_status_cb, mode_id); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 387 | } |
| 388 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 389 | Return<void> WifiChip::getMode(getMode_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 390 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 391 | &WifiChip::getModeInternal, hidl_status_cb); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 394 | Return<void> WifiChip::requestChipDebugInfo( |
| 395 | requestChipDebugInfo_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 396 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 397 | &WifiChip::requestChipDebugInfoInternal, |
| 398 | hidl_status_cb); |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 399 | } |
| 400 | |
| 401 | Return<void> WifiChip::requestDriverDebugDump( |
| 402 | requestDriverDebugDump_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 403 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 404 | &WifiChip::requestDriverDebugDumpInternal, |
| 405 | hidl_status_cb); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 406 | } |
| 407 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 408 | Return<void> WifiChip::requestFirmwareDebugDump( |
| 409 | requestFirmwareDebugDump_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 410 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 411 | &WifiChip::requestFirmwareDebugDumpInternal, |
| 412 | hidl_status_cb); |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 413 | } |
| 414 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 415 | Return<void> WifiChip::createApIface(createApIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 416 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 417 | &WifiChip::createApIfaceInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 418 | } |
| 419 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 420 | Return<void> WifiChip::getApIfaceNames(getApIfaceNames_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 421 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 422 | &WifiChip::getApIfaceNamesInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 423 | } |
| 424 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 425 | Return<void> WifiChip::getApIface(const hidl_string& ifname, |
| 426 | getApIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 427 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 428 | &WifiChip::getApIfaceInternal, hidl_status_cb, |
| 429 | ifname); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 430 | } |
| 431 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 432 | Return<void> WifiChip::removeApIface(const hidl_string& ifname, |
| 433 | removeApIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 434 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 435 | &WifiChip::removeApIfaceInternal, hidl_status_cb, |
| 436 | ifname); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 437 | } |
| 438 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 439 | Return<void> WifiChip::createNanIface(createNanIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 440 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 441 | &WifiChip::createNanIfaceInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 444 | Return<void> WifiChip::getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 445 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 446 | &WifiChip::getNanIfaceNamesInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | Return<void> WifiChip::getNanIface(const hidl_string& ifname, |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 450 | getNanIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 451 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 452 | &WifiChip::getNanIfaceInternal, hidl_status_cb, |
| 453 | ifname); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 456 | Return<void> WifiChip::removeNanIface(const hidl_string& ifname, |
| 457 | removeNanIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 458 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 459 | &WifiChip::removeNanIfaceInternal, hidl_status_cb, |
| 460 | ifname); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 461 | } |
| 462 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 463 | Return<void> WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 464 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 465 | &WifiChip::createP2pIfaceInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 468 | Return<void> WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 469 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 470 | &WifiChip::getP2pIfaceNamesInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | Return<void> WifiChip::getP2pIface(const hidl_string& ifname, |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 474 | getP2pIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 475 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 476 | &WifiChip::getP2pIfaceInternal, hidl_status_cb, |
| 477 | ifname); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 480 | Return<void> WifiChip::removeP2pIface(const hidl_string& ifname, |
| 481 | removeP2pIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 482 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 483 | &WifiChip::removeP2pIfaceInternal, hidl_status_cb, |
| 484 | ifname); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 485 | } |
| 486 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 487 | Return<void> WifiChip::createStaIface(createStaIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 488 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 489 | &WifiChip::createStaIfaceInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 490 | } |
| 491 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 492 | Return<void> WifiChip::getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 493 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 494 | &WifiChip::getStaIfaceNamesInternal, hidl_status_cb); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | Return<void> WifiChip::getStaIface(const hidl_string& ifname, |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 498 | getStaIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 499 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 500 | &WifiChip::getStaIfaceInternal, hidl_status_cb, |
| 501 | ifname); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 502 | } |
| 503 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 504 | Return<void> WifiChip::removeStaIface(const hidl_string& ifname, |
| 505 | removeStaIface_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 506 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 507 | &WifiChip::removeStaIfaceInternal, hidl_status_cb, |
| 508 | ifname); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 509 | } |
| 510 | |
Roshan Pius | 5c05546 | 2016-10-11 08:27:27 -0700 | [diff] [blame] | 511 | Return<void> WifiChip::createRttController( |
| 512 | const sp<IWifiIface>& bound_iface, createRttController_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 513 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 514 | &WifiChip::createRttControllerInternal, |
| 515 | hidl_status_cb, bound_iface); |
Roshan Pius | 5926828 | 2016-10-06 20:23:47 -0700 | [diff] [blame] | 516 | } |
| 517 | |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 518 | Return<void> WifiChip::getDebugRingBuffersStatus( |
| 519 | getDebugRingBuffersStatus_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 520 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 521 | &WifiChip::getDebugRingBuffersStatusInternal, |
| 522 | hidl_status_cb); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | Return<void> WifiChip::startLoggingToDebugRingBuffer( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 526 | const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, |
| 527 | uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 528 | startLoggingToDebugRingBuffer_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 529 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 530 | &WifiChip::startLoggingToDebugRingBufferInternal, |
| 531 | hidl_status_cb, ring_name, verbose_level, |
| 532 | max_interval_in_sec, min_data_size_in_bytes); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | Return<void> WifiChip::forceDumpToDebugRingBuffer( |
| 536 | const hidl_string& ring_name, |
| 537 | forceDumpToDebugRingBuffer_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 538 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 539 | &WifiChip::forceDumpToDebugRingBufferInternal, |
| 540 | hidl_status_cb, ring_name); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 541 | } |
| 542 | |
Roger Wang | b294c76 | 2018-11-02 15:34:39 +0800 | [diff] [blame] | 543 | Return<void> WifiChip::flushRingBufferToFile( |
| 544 | flushRingBufferToFile_cb hidl_status_cb) { |
| 545 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 546 | &WifiChip::flushRingBufferToFileInternal, |
| 547 | hidl_status_cb); |
| 548 | } |
| 549 | |
Roshan Pius | 8c0c8e9 | 2017-02-24 08:07:42 -0800 | [diff] [blame] | 550 | Return<void> WifiChip::stopLoggingToDebugRingBuffer( |
| 551 | stopLoggingToDebugRingBuffer_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 552 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 553 | &WifiChip::stopLoggingToDebugRingBufferInternal, |
| 554 | hidl_status_cb); |
Roshan Pius | 8c0c8e9 | 2017-02-24 08:07:42 -0800 | [diff] [blame] | 555 | } |
| 556 | |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 557 | Return<void> WifiChip::getDebugHostWakeReasonStats( |
| 558 | getDebugHostWakeReasonStats_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 559 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 560 | &WifiChip::getDebugHostWakeReasonStatsInternal, |
| 561 | hidl_status_cb); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 562 | } |
| 563 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 564 | Return<void> WifiChip::enableDebugErrorAlerts( |
| 565 | bool enable, enableDebugErrorAlerts_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 566 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 567 | &WifiChip::enableDebugErrorAlertsInternal, |
| 568 | hidl_status_cb, enable); |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 569 | } |
| 570 | |
Roshan Pius | 735ff43 | 2017-07-25 08:48:08 -0700 | [diff] [blame] | 571 | Return<void> WifiChip::selectTxPowerScenario( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 572 | V1_1::IWifiChip::TxPowerScenario scenario, |
| 573 | selectTxPowerScenario_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 574 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 575 | &WifiChip::selectTxPowerScenarioInternal, |
| 576 | hidl_status_cb, scenario); |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 577 | } |
| 578 | |
Roshan Pius | 735ff43 | 2017-07-25 08:48:08 -0700 | [diff] [blame] | 579 | Return<void> WifiChip::resetTxPowerScenario( |
| 580 | resetTxPowerScenario_cb hidl_status_cb) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 581 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 582 | &WifiChip::resetTxPowerScenarioInternal, |
| 583 | hidl_status_cb); |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 584 | } |
| 585 | |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 586 | Return<void> WifiChip::setLatencyMode(LatencyMode mode, |
| 587 | setLatencyMode_cb hidl_status_cb) { |
| 588 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 589 | &WifiChip::setLatencyModeInternal, hidl_status_cb, |
| 590 | mode); |
| 591 | } |
| 592 | |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 593 | Return<void> WifiChip::registerEventCallback_1_2( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 594 | const sp<V1_2::IWifiChipEventCallback>& event_callback, |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 595 | registerEventCallback_cb hidl_status_cb) { |
| 596 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 597 | &WifiChip::registerEventCallbackInternal_1_2, |
| 598 | hidl_status_cb, event_callback); |
| 599 | } |
| 600 | |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 601 | Return<void> WifiChip::selectTxPowerScenario_1_2( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 602 | TxPowerScenario scenario, selectTxPowerScenario_cb hidl_status_cb) { |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 603 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 604 | &WifiChip::selectTxPowerScenarioInternal_1_2, |
| 605 | hidl_status_cb, scenario); |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 606 | } |
| 607 | |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 608 | Return<void> WifiChip::getCapabilities_1_3(getCapabilities_cb hidl_status_cb) { |
| 609 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 610 | &WifiChip::getCapabilitiesInternal_1_3, |
| 611 | hidl_status_cb); |
| 612 | } |
| 613 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 614 | Return<void> WifiChip::debug(const hidl_handle& handle, |
| 615 | const hidl_vec<hidl_string>&) { |
| 616 | if (handle != nullptr && handle->numFds >= 1) { |
| 617 | int fd = handle->data[0]; |
| 618 | if (!writeRingbufferFilesInternal()) { |
| 619 | LOG(ERROR) << "Error writing files to flash"; |
| 620 | } |
xshu | 4cb3316 | 2018-01-24 15:40:06 -0800 | [diff] [blame] | 621 | uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 622 | if (n_error != 0) { |
| 623 | LOG(ERROR) << n_error << " errors occured in cpio function"; |
| 624 | } |
| 625 | fsync(fd); |
| 626 | } else { |
| 627 | LOG(ERROR) << "File handle error"; |
| 628 | } |
| 629 | return Void(); |
| 630 | } |
| 631 | |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 632 | Return<void> WifiChip::createRttController_1_4( |
| 633 | const sp<IWifiIface>& bound_iface, |
| 634 | createRttController_1_4_cb hidl_status_cb) { |
| 635 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 636 | &WifiChip::createRttControllerInternal_1_4, |
| 637 | hidl_status_cb, bound_iface); |
| 638 | } |
| 639 | |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 640 | Return<void> WifiChip::registerEventCallback_1_4( |
| 641 | const sp<IWifiChipEventCallback>& event_callback, |
| 642 | registerEventCallback_cb hidl_status_cb) { |
| 643 | return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, |
| 644 | &WifiChip::registerEventCallbackInternal_1_4, |
| 645 | hidl_status_cb, event_callback); |
| 646 | } |
| 647 | |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 648 | void WifiChip::invalidateAndRemoveAllIfaces() { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 649 | invalidateAndClearAll(ap_ifaces_); |
| 650 | invalidateAndClearAll(nan_ifaces_); |
| 651 | invalidateAndClearAll(p2p_ifaces_); |
| 652 | invalidateAndClearAll(sta_ifaces_); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 653 | // Since all the ifaces are invalid now, all RTT controller objects |
| 654 | // using those ifaces also need to be invalidated. |
| 655 | for (const auto& rtt : rtt_controllers_) { |
| 656 | rtt->invalidate(); |
| 657 | } |
| 658 | rtt_controllers_.clear(); |
Roshan Pius | 35d958c | 2016-10-06 16:47:38 -0700 | [diff] [blame] | 659 | } |
| 660 | |
Roshan Pius | 8236850 | 2019-05-16 12:53:02 -0700 | [diff] [blame] | 661 | void WifiChip::invalidateAndRemoveDependencies( |
| 662 | const std::string& removed_iface_name) { |
| 663 | for (const auto& nan_iface : nan_ifaces_) { |
| 664 | if (nan_iface->getName() == removed_iface_name) { |
| 665 | invalidateAndClear(nan_ifaces_, nan_iface); |
| 666 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 667 | if (!callback |
| 668 | ->onIfaceRemoved(IfaceType::NAN, removed_iface_name) |
| 669 | .isOk()) { |
| 670 | LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; |
| 671 | } |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | for (const auto& rtt : rtt_controllers_) { |
| 676 | if (rtt->getIfaceName() == removed_iface_name) { |
| 677 | invalidateAndClear(rtt_controllers_, rtt); |
| 678 | } |
| 679 | } |
| 680 | } |
| 681 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 682 | std::pair<WifiStatus, ChipId> WifiChip::getIdInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 683 | return {createWifiStatus(WifiStatusCode::SUCCESS), chip_id_}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 684 | } |
| 685 | |
| 686 | WifiStatus WifiChip::registerEventCallbackInternal( |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 687 | const sp<V1_0::IWifiChipEventCallback>& /* event_callback */) { |
| 688 | // Deprecated support for this callback. |
| 689 | return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 690 | } |
| 691 | |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 692 | std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal() { |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 693 | // Deprecated support for this callback. |
| 694 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; |
| 695 | } |
| 696 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 697 | std::pair<WifiStatus, std::vector<IWifiChip::ChipMode>> |
| 698 | WifiChip::getAvailableModesInternal() { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 699 | return {createWifiStatus(WifiStatusCode::SUCCESS), modes_}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 700 | } |
| 701 | |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 702 | WifiStatus WifiChip::configureChipInternal( |
| 703 | /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, |
| 704 | ChipModeId mode_id) { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 705 | if (!isValidModeId(mode_id)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 706 | return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); |
| 707 | } |
| 708 | if (mode_id == current_mode_id_) { |
| 709 | LOG(DEBUG) << "Already in the specified mode " << mode_id; |
| 710 | return createWifiStatus(WifiStatusCode::SUCCESS); |
| 711 | } |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 712 | WifiStatus status = handleChipConfiguration(lock, mode_id); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 713 | if (status.code != WifiStatusCode::SUCCESS) { |
| 714 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 715 | if (!callback->onChipReconfigureFailure(status).isOk()) { |
| 716 | LOG(ERROR) |
| 717 | << "Failed to invoke onChipReconfigureFailure callback"; |
| 718 | } |
| 719 | } |
| 720 | return status; |
| 721 | } |
Roshan Pius | d37341f | 2017-01-31 13:13:28 -0800 | [diff] [blame] | 722 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 723 | if (!callback->onChipReconfigured(mode_id).isOk()) { |
| 724 | LOG(ERROR) << "Failed to invoke onChipReconfigured callback"; |
| 725 | } |
Roshan Pius | 52947fb | 2016-11-18 11:38:07 -0800 | [diff] [blame] | 726 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 727 | current_mode_id_ = mode_id; |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 728 | LOG(INFO) << "Configured chip in mode " << mode_id; |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 729 | setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 730 | return status; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | std::pair<WifiStatus, uint32_t> WifiChip::getModeInternal() { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 734 | if (!isValidModeId(current_mode_id_)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 735 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), |
| 736 | current_mode_id_}; |
| 737 | } |
| 738 | return {createWifiStatus(WifiStatusCode::SUCCESS), current_mode_id_}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 739 | } |
| 740 | |
| 741 | std::pair<WifiStatus, IWifiChip::ChipDebugInfo> |
| 742 | WifiChip::requestChipDebugInfoInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 743 | IWifiChip::ChipDebugInfo result; |
| 744 | legacy_hal::wifi_error legacy_status; |
| 745 | std::string driver_desc; |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 746 | const auto ifname = getFirstActiveWlanIfaceName(); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 747 | std::tie(legacy_status, driver_desc) = |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 748 | legacy_hal_.lock()->getDriverVersion(ifname); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 749 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 750 | LOG(ERROR) << "Failed to get driver version: " |
| 751 | << legacyErrorToString(legacy_status); |
| 752 | WifiStatus status = createWifiStatusFromLegacyError( |
| 753 | legacy_status, "failed to get driver version"); |
| 754 | return {status, result}; |
| 755 | } |
| 756 | result.driverDescription = driver_desc.c_str(); |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 757 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 758 | std::string firmware_desc; |
| 759 | std::tie(legacy_status, firmware_desc) = |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 760 | legacy_hal_.lock()->getFirmwareVersion(ifname); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 761 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 762 | LOG(ERROR) << "Failed to get firmware version: " |
| 763 | << legacyErrorToString(legacy_status); |
| 764 | WifiStatus status = createWifiStatusFromLegacyError( |
| 765 | legacy_status, "failed to get firmware version"); |
| 766 | return {status, result}; |
| 767 | } |
| 768 | result.firmwareDescription = firmware_desc.c_str(); |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 769 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 770 | return {createWifiStatus(WifiStatusCode::SUCCESS), result}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | std::pair<WifiStatus, std::vector<uint8_t>> |
| 774 | WifiChip::requestDriverDebugDumpInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 775 | legacy_hal::wifi_error legacy_status; |
| 776 | std::vector<uint8_t> driver_dump; |
| 777 | std::tie(legacy_status, driver_dump) = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 778 | legacy_hal_.lock()->requestDriverMemoryDump( |
| 779 | getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 780 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 781 | LOG(ERROR) << "Failed to get driver debug dump: " |
| 782 | << legacyErrorToString(legacy_status); |
| 783 | return {createWifiStatusFromLegacyError(legacy_status), |
| 784 | std::vector<uint8_t>()}; |
| 785 | } |
| 786 | return {createWifiStatus(WifiStatusCode::SUCCESS), driver_dump}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | std::pair<WifiStatus, std::vector<uint8_t>> |
| 790 | WifiChip::requestFirmwareDebugDumpInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 791 | legacy_hal::wifi_error legacy_status; |
| 792 | std::vector<uint8_t> firmware_dump; |
| 793 | std::tie(legacy_status, firmware_dump) = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 794 | legacy_hal_.lock()->requestFirmwareMemoryDump( |
| 795 | getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 796 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 797 | LOG(ERROR) << "Failed to get firmware debug dump: " |
| 798 | << legacyErrorToString(legacy_status); |
| 799 | return {createWifiStatusFromLegacyError(legacy_status), {}}; |
| 800 | } |
| 801 | return {createWifiStatus(WifiStatusCode::SUCCESS), firmware_dump}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::createApIfaceInternal() { |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 805 | if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::AP)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 806 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 807 | } |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 808 | std::string ifname = allocateApIfaceName(); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 809 | legacy_hal::wifi_error legacy_status = |
| 810 | legacy_hal_.lock()->createVirtualInterface( |
| 811 | ifname, |
| 812 | hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::AP)); |
| 813 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 814 | LOG(ERROR) << "Failed to add interface: " << ifname << " " |
| 815 | << legacyErrorToString(legacy_status); |
| 816 | return {createWifiStatusFromLegacyError(legacy_status), {}}; |
| 817 | } |
Patrik Fimml | 6beae32 | 2019-10-09 17:34:01 +0200 | [diff] [blame] | 818 | sp<WifiApIface> iface = new WifiApIface(ifname, legacy_hal_, iface_util_); |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 819 | ap_ifaces_.push_back(iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 820 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 821 | if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { |
| 822 | LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; |
| 823 | } |
| 824 | } |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 825 | setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 826 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | std::pair<WifiStatus, std::vector<hidl_string>> |
| 830 | WifiChip::getApIfaceNamesInternal() { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 831 | if (ap_ifaces_.empty()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 832 | return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; |
| 833 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 834 | return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(ap_ifaces_)}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::getApIfaceInternal( |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 838 | const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 839 | const auto iface = findUsingName(ap_ifaces_, ifname); |
| 840 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 841 | return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; |
| 842 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 843 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 844 | } |
| 845 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 846 | WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 847 | const auto iface = findUsingName(ap_ifaces_, ifname); |
| 848 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 849 | return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 850 | } |
Roshan Pius | 8236850 | 2019-05-16 12:53:02 -0700 | [diff] [blame] | 851 | // Invalidate & remove any dependent objects first. |
| 852 | // Note: This is probably not required because we never create |
| 853 | // nan/rtt objects over AP iface. But, there is no harm to do it |
| 854 | // here and not make that assumption all over the place. |
| 855 | invalidateAndRemoveDependencies(ifname); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 856 | legacy_hal::wifi_error legacy_status = |
| 857 | legacy_hal_.lock()->deleteVirtualInterface(ifname); |
| 858 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 859 | LOG(ERROR) << "Failed to remove interface: " << ifname << " " |
| 860 | << legacyErrorToString(legacy_status); |
| 861 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 862 | invalidateAndClear(ap_ifaces_, iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 863 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 864 | if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) { |
| 865 | LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; |
| 866 | } |
| 867 | } |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 868 | setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 869 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 870 | } |
| 871 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 872 | std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() { |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 873 | if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::NAN)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 874 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; |
Etan Cohen | c570040 | 2017-03-08 16:43:38 -0800 | [diff] [blame] | 875 | } |
Roshan Pius | 5ba0a90 | 2020-04-14 11:55:42 -0700 | [diff] [blame] | 876 | bool is_dedicated_iface = true; |
| 877 | std::string ifname = getNanIfaceName(); |
| 878 | if (ifname.empty()) { |
| 879 | // Use the first shared STA iface (wlan0) if a dedicated aware iface is |
| 880 | // not defined. |
| 881 | ifname = getFirstActiveWlanIfaceName(); |
| 882 | is_dedicated_iface = false; |
| 883 | } |
| 884 | sp<WifiNanIface> iface = |
| 885 | new WifiNanIface(ifname, is_dedicated_iface, legacy_hal_, iface_util_); |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 886 | nan_ifaces_.push_back(iface); |
| 887 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 888 | if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) { |
| 889 | LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; |
| 890 | } |
| 891 | } |
| 892 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 893 | } |
| 894 | |
| 895 | std::pair<WifiStatus, std::vector<hidl_string>> |
| 896 | WifiChip::getNanIfaceNamesInternal() { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 897 | if (nan_ifaces_.empty()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 898 | return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; |
| 899 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 900 | return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(nan_ifaces_)}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::getNanIfaceInternal( |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 904 | const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 905 | const auto iface = findUsingName(nan_ifaces_, ifname); |
| 906 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 907 | return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; |
| 908 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 909 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 910 | } |
| 911 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 912 | WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 913 | const auto iface = findUsingName(nan_ifaces_, ifname); |
| 914 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 915 | return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 916 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 917 | invalidateAndClear(nan_ifaces_, iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 918 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 919 | if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) { |
| 920 | LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; |
| 921 | } |
| 922 | } |
| 923 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 924 | } |
| 925 | |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 926 | std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::createP2pIfaceInternal() { |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 927 | if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::P2P)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 928 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 929 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 930 | std::string ifname = getP2pIfaceName(); |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 931 | sp<WifiP2pIface> iface = new WifiP2pIface(ifname, legacy_hal_); |
| 932 | p2p_ifaces_.push_back(iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 933 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 934 | if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) { |
| 935 | LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; |
| 936 | } |
| 937 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 938 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | std::pair<WifiStatus, std::vector<hidl_string>> |
| 942 | WifiChip::getP2pIfaceNamesInternal() { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 943 | if (p2p_ifaces_.empty()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 944 | return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; |
| 945 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 946 | return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(p2p_ifaces_)}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 947 | } |
| 948 | |
| 949 | std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::getP2pIfaceInternal( |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 950 | const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 951 | const auto iface = findUsingName(p2p_ifaces_, ifname); |
| 952 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 953 | return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; |
| 954 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 955 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 956 | } |
| 957 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 958 | WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 959 | const auto iface = findUsingName(p2p_ifaces_, ifname); |
| 960 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 961 | return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 962 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 963 | invalidateAndClear(p2p_ifaces_, iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 964 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 965 | if (!callback->onIfaceRemoved(IfaceType::P2P, ifname).isOk()) { |
| 966 | LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; |
| 967 | } |
| 968 | } |
| 969 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 970 | } |
| 971 | |
Ahmed ElArabawy | b23485d | 2019-12-09 15:24:16 -0800 | [diff] [blame] | 972 | std::pair<WifiStatus, sp<V1_3::IWifiStaIface>> |
| 973 | WifiChip::createStaIfaceInternal() { |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 974 | if (!canCurrentModeSupportIfaceOfTypeWithCurrentIfaces(IfaceType::STA)) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 975 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 976 | } |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 977 | std::string ifname = allocateStaIfaceName(); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 978 | legacy_hal::wifi_error legacy_status = |
| 979 | legacy_hal_.lock()->createVirtualInterface( |
| 980 | ifname, |
| 981 | hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::STA)); |
| 982 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 983 | LOG(ERROR) << "Failed to add interface: " << ifname << " " |
| 984 | << legacyErrorToString(legacy_status); |
| 985 | return {createWifiStatusFromLegacyError(legacy_status), {}}; |
| 986 | } |
Roshan Pius | 99dab38 | 2019-02-14 07:57:10 -0800 | [diff] [blame] | 987 | sp<WifiStaIface> iface = new WifiStaIface(ifname, legacy_hal_, iface_util_); |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 988 | sta_ifaces_.push_back(iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 989 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 990 | if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { |
| 991 | LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; |
| 992 | } |
| 993 | } |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 994 | setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 995 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 996 | } |
| 997 | |
| 998 | std::pair<WifiStatus, std::vector<hidl_string>> |
| 999 | WifiChip::getStaIfaceNamesInternal() { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1000 | if (sta_ifaces_.empty()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1001 | return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; |
| 1002 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1003 | return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 1004 | } |
| 1005 | |
Ahmed ElArabawy | b23485d | 2019-12-09 15:24:16 -0800 | [diff] [blame] | 1006 | std::pair<WifiStatus, sp<V1_3::IWifiStaIface>> WifiChip::getStaIfaceInternal( |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 1007 | const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1008 | const auto iface = findUsingName(sta_ifaces_, ifname); |
| 1009 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1010 | return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; |
| 1011 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1012 | return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 1013 | } |
| 1014 | |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 1015 | WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1016 | const auto iface = findUsingName(sta_ifaces_, ifname); |
| 1017 | if (!iface.get()) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1018 | return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); |
Roshan Pius | bc66220 | 2017-01-30 17:07:42 -0800 | [diff] [blame] | 1019 | } |
Roshan Pius | 8236850 | 2019-05-16 12:53:02 -0700 | [diff] [blame] | 1020 | // Invalidate & remove any dependent objects first. |
| 1021 | invalidateAndRemoveDependencies(ifname); |
Sunil Ravi | ddab4bb | 2020-02-03 22:45:19 -0800 | [diff] [blame] | 1022 | legacy_hal::wifi_error legacy_status = |
| 1023 | legacy_hal_.lock()->deleteVirtualInterface(ifname); |
| 1024 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1025 | LOG(ERROR) << "Failed to remove interface: " << ifname << " " |
| 1026 | << legacyErrorToString(legacy_status); |
| 1027 | } |
Roshan Pius | 675609b | 2017-10-31 14:24:58 -0700 | [diff] [blame] | 1028 | invalidateAndClear(sta_ifaces_, iface); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1029 | for (const auto& callback : event_cb_handler_.getCallbacks()) { |
| 1030 | if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) { |
| 1031 | LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; |
| 1032 | } |
| 1033 | } |
Roshan Pius | 8574e7f | 2019-04-01 13:30:40 -0700 | [diff] [blame] | 1034 | setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1035 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 8b55e6f | 2016-12-09 12:05:12 -0800 | [diff] [blame] | 1036 | } |
| 1037 | |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 1038 | std::pair<WifiStatus, sp<V1_0::IWifiRttController>> |
| 1039 | WifiChip::createRttControllerInternal(const sp<IWifiIface>& /*bound_iface*/) { |
| 1040 | LOG(ERROR) << "createRttController is not supported on this HAL"; |
Ahmed ElArabawy | 36defb3 | 2019-12-29 21:24:27 -0800 | [diff] [blame] | 1041 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; |
Roshan Pius | 3c86852 | 2016-10-27 12:43:49 -0700 | [diff] [blame] | 1042 | } |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1043 | |
| 1044 | std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>> |
| 1045 | WifiChip::getDebugRingBuffersStatusInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1046 | legacy_hal::wifi_error legacy_status; |
| 1047 | std::vector<legacy_hal::wifi_ring_buffer_status> |
| 1048 | legacy_ring_buffer_status_vec; |
| 1049 | std::tie(legacy_status, legacy_ring_buffer_status_vec) = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1050 | legacy_hal_.lock()->getRingBuffersStatus(getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1051 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1052 | return {createWifiStatusFromLegacyError(legacy_status), {}}; |
| 1053 | } |
| 1054 | std::vector<WifiDebugRingBufferStatus> hidl_ring_buffer_status_vec; |
| 1055 | if (!hidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToHidl( |
| 1056 | legacy_ring_buffer_status_vec, &hidl_ring_buffer_status_vec)) { |
| 1057 | return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; |
| 1058 | } |
| 1059 | return {createWifiStatus(WifiStatusCode::SUCCESS), |
| 1060 | hidl_ring_buffer_status_vec}; |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1061 | } |
| 1062 | |
| 1063 | WifiStatus WifiChip::startLoggingToDebugRingBufferInternal( |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1064 | const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, |
| 1065 | uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes) { |
| 1066 | WifiStatus status = registerDebugRingBufferCallback(); |
| 1067 | if (status.code != WifiStatusCode::SUCCESS) { |
| 1068 | return status; |
| 1069 | } |
| 1070 | legacy_hal::wifi_error legacy_status = |
| 1071 | legacy_hal_.lock()->startRingBufferLogging( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1072 | getFirstActiveWlanIfaceName(), ring_name, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1073 | static_cast< |
| 1074 | std::underlying_type<WifiDebugRingBufferVerboseLevel>::type>( |
| 1075 | verbose_level), |
| 1076 | max_interval_in_sec, min_data_size_in_bytes); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1077 | ringbuffer_map_.insert(std::pair<std::string, Ringbuffer>( |
| 1078 | ring_name, Ringbuffer(kMaxBufferSizeBytes))); |
Roshan Pius | a63b53f | 2019-11-18 11:03:13 -0800 | [diff] [blame] | 1079 | // if verbose logging enabled, turn up HAL daemon logging as well. |
| 1080 | if (verbose_level < WifiDebugRingBufferVerboseLevel::VERBOSE) { |
| 1081 | android::base::SetMinimumLogSeverity(android::base::DEBUG); |
| 1082 | } else { |
| 1083 | android::base::SetMinimumLogSeverity(android::base::VERBOSE); |
| 1084 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1085 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1086 | } |
| 1087 | |
| 1088 | WifiStatus WifiChip::forceDumpToDebugRingBufferInternal( |
Roshan Pius | e2d0ab5 | 2016-12-05 15:24:20 -0800 | [diff] [blame] | 1089 | const hidl_string& ring_name) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1090 | WifiStatus status = registerDebugRingBufferCallback(); |
| 1091 | if (status.code != WifiStatusCode::SUCCESS) { |
| 1092 | return status; |
| 1093 | } |
| 1094 | legacy_hal::wifi_error legacy_status = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1095 | legacy_hal_.lock()->getRingBufferData(getFirstActiveWlanIfaceName(), |
| 1096 | ring_name); |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1097 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1098 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1099 | } |
| 1100 | |
Roger Wang | b294c76 | 2018-11-02 15:34:39 +0800 | [diff] [blame] | 1101 | WifiStatus WifiChip::flushRingBufferToFileInternal() { |
| 1102 | if (!writeRingbufferFilesInternal()) { |
| 1103 | LOG(ERROR) << "Error writing files to flash"; |
| 1104 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); |
| 1105 | } |
| 1106 | return createWifiStatus(WifiStatusCode::SUCCESS); |
| 1107 | } |
| 1108 | |
Roshan Pius | 8c0c8e9 | 2017-02-24 08:07:42 -0800 | [diff] [blame] | 1109 | WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1110 | legacy_hal::wifi_error legacy_status = |
| 1111 | legacy_hal_.lock()->deregisterRingBufferCallbackHandler( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1112 | getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1113 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | 8c0c8e9 | 2017-02-24 08:07:42 -0800 | [diff] [blame] | 1114 | } |
| 1115 | |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1116 | std::pair<WifiStatus, WifiDebugHostWakeReasonStats> |
| 1117 | WifiChip::getDebugHostWakeReasonStatsInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1118 | legacy_hal::wifi_error legacy_status; |
| 1119 | legacy_hal::WakeReasonStats legacy_stats; |
| 1120 | std::tie(legacy_status, legacy_stats) = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1121 | legacy_hal_.lock()->getWakeReasonStats(getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1122 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1123 | return {createWifiStatusFromLegacyError(legacy_status), {}}; |
| 1124 | } |
| 1125 | WifiDebugHostWakeReasonStats hidl_stats; |
| 1126 | if (!hidl_struct_util::convertLegacyWakeReasonStatsToHidl(legacy_stats, |
| 1127 | &hidl_stats)) { |
| 1128 | return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; |
| 1129 | } |
| 1130 | return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; |
Roshan Pius | 7d08d7a | 2016-10-27 14:35:05 -0700 | [diff] [blame] | 1131 | } |
| 1132 | |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 1133 | WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1134 | legacy_hal::wifi_error legacy_status; |
| 1135 | if (enable) { |
| 1136 | android::wp<WifiChip> weak_ptr_this(this); |
| 1137 | const auto& on_alert_callback = [weak_ptr_this]( |
| 1138 | int32_t error_code, |
| 1139 | std::vector<uint8_t> debug_data) { |
| 1140 | const auto shared_ptr_this = weak_ptr_this.promote(); |
| 1141 | if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { |
| 1142 | LOG(ERROR) << "Callback invoked on an invalid object"; |
| 1143 | return; |
| 1144 | } |
| 1145 | for (const auto& callback : shared_ptr_this->getEventCallbacks()) { |
| 1146 | if (!callback->onDebugErrorAlert(error_code, debug_data) |
| 1147 | .isOk()) { |
| 1148 | LOG(ERROR) << "Failed to invoke onDebugErrorAlert callback"; |
| 1149 | } |
| 1150 | } |
| 1151 | }; |
| 1152 | legacy_status = legacy_hal_.lock()->registerErrorAlertCallbackHandler( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1153 | getFirstActiveWlanIfaceName(), on_alert_callback); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1154 | } else { |
| 1155 | legacy_status = legacy_hal_.lock()->deregisterErrorAlertCallbackHandler( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1156 | getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1157 | } |
| 1158 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | 203cb03 | 2016-12-14 17:41:20 -0800 | [diff] [blame] | 1159 | } |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 1160 | |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 1161 | WifiStatus WifiChip::selectTxPowerScenarioInternal( |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 1162 | V1_1::IWifiChip::TxPowerScenario scenario) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1163 | auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1164 | getFirstActiveWlanIfaceName(), |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1165 | hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario)); |
| 1166 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 1167 | } |
| 1168 | |
Roshan Pius | 735ff43 | 2017-07-25 08:48:08 -0700 | [diff] [blame] | 1169 | WifiStatus WifiChip::resetTxPowerScenarioInternal() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1170 | auto legacy_status = |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1171 | legacy_hal_.lock()->resetTxPowerScenario(getFirstActiveWlanIfaceName()); |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1172 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | dbd83ef | 2017-06-20 12:05:40 -0700 | [diff] [blame] | 1173 | } |
| 1174 | |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 1175 | WifiStatus WifiChip::setLatencyModeInternal(LatencyMode mode) { |
| 1176 | auto legacy_status = legacy_hal_.lock()->setLatencyMode( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1177 | getFirstActiveWlanIfaceName(), |
Ahmed ElArabawy | eaf8240 | 2018-10-26 09:46:04 -0700 | [diff] [blame] | 1178 | hidl_struct_util::convertHidlLatencyModeToLegacy(mode)); |
| 1179 | return createWifiStatusFromLegacyError(legacy_status); |
| 1180 | } |
| 1181 | |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 1182 | WifiStatus WifiChip::registerEventCallbackInternal_1_2( |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 1183 | const sp<V1_2::IWifiChipEventCallback>& /* event_callback */) { |
| 1184 | // Deprecated support for this callback. |
| 1185 | return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); |
Roshan Pius | 1ce92cf | 2018-01-22 16:12:19 -0800 | [diff] [blame] | 1186 | } |
| 1187 | |
Jong Wook Kim | da830c9 | 2018-07-23 15:29:38 -0700 | [diff] [blame] | 1188 | WifiStatus WifiChip::selectTxPowerScenarioInternal_1_2( |
| 1189 | TxPowerScenario scenario) { |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 1190 | auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1191 | getFirstActiveWlanIfaceName(), |
Ahmed ElArabawy | 6a1accf | 2018-01-23 10:57:29 -0800 | [diff] [blame] | 1192 | hidl_struct_util::convertHidlTxPowerScenarioToLegacy_1_2(scenario)); |
| 1193 | return createWifiStatusFromLegacyError(legacy_status); |
| 1194 | } |
| 1195 | |
Ahmed ElArabawy | eeb5338 | 2019-10-10 20:18:31 -0700 | [diff] [blame] | 1196 | std::pair<WifiStatus, uint32_t> WifiChip::getCapabilitiesInternal_1_3() { |
| 1197 | legacy_hal::wifi_error legacy_status; |
| 1198 | uint32_t legacy_feature_set; |
| 1199 | uint32_t legacy_logger_feature_set; |
| 1200 | const auto ifname = getFirstActiveWlanIfaceName(); |
| 1201 | std::tie(legacy_status, legacy_feature_set) = |
| 1202 | legacy_hal_.lock()->getSupportedFeatureSet(ifname); |
| 1203 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1204 | return {createWifiStatusFromLegacyError(legacy_status), 0}; |
| 1205 | } |
| 1206 | std::tie(legacy_status, legacy_logger_feature_set) = |
| 1207 | legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); |
| 1208 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1209 | // some devices don't support querying logger feature set |
| 1210 | legacy_logger_feature_set = 0; |
| 1211 | } |
| 1212 | uint32_t hidl_caps; |
| 1213 | if (!hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( |
| 1214 | legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { |
| 1215 | return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; |
| 1216 | } |
| 1217 | return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; |
| 1218 | } |
| 1219 | |
| 1220 | std::pair<WifiStatus, sp<IWifiRttController>> |
| 1221 | WifiChip::createRttControllerInternal_1_4(const sp<IWifiIface>& bound_iface) { |
| 1222 | if (sta_ifaces_.size() == 0 && |
| 1223 | !canCurrentModeSupportIfaceOfType(IfaceType::STA)) { |
| 1224 | LOG(ERROR) |
| 1225 | << "createRttControllerInternal_1_4: Chip cannot support STAs " |
| 1226 | "(and RTT by extension)"; |
| 1227 | return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; |
| 1228 | } |
| 1229 | sp<WifiRttController> rtt = new WifiRttController( |
| 1230 | getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); |
| 1231 | rtt_controllers_.emplace_back(rtt); |
| 1232 | return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; |
| 1233 | } |
| 1234 | |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 1235 | WifiStatus WifiChip::registerEventCallbackInternal_1_4( |
| 1236 | const sp<IWifiChipEventCallback>& event_callback) { |
| 1237 | if (!event_cb_handler_.addCallback(event_callback)) { |
| 1238 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); |
| 1239 | } |
| 1240 | return createWifiStatus(WifiStatusCode::SUCCESS); |
| 1241 | } |
| 1242 | |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 1243 | WifiStatus WifiChip::handleChipConfiguration( |
| 1244 | /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, |
| 1245 | ChipModeId mode_id) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1246 | // If the chip is already configured in a different mode, stop |
| 1247 | // the legacy HAL and then start it after firmware mode change. |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1248 | if (isValidModeId(current_mode_id_)) { |
Roshan Pius | ba38d9c | 2017-12-08 07:32:08 -0800 | [diff] [blame] | 1249 | LOG(INFO) << "Reconfiguring chip from mode " << current_mode_id_ |
| 1250 | << " to mode " << mode_id; |
| 1251 | invalidateAndRemoveAllIfaces(); |
| 1252 | legacy_hal::wifi_error legacy_status = |
| 1253 | legacy_hal_.lock()->stop(lock, []() {}); |
| 1254 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1255 | LOG(ERROR) << "Failed to stop legacy HAL: " |
| 1256 | << legacyErrorToString(legacy_status); |
| 1257 | return createWifiStatusFromLegacyError(legacy_status); |
| 1258 | } |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1259 | } |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1260 | // Firmware mode change not needed for V2 devices. |
| 1261 | bool success = true; |
Tomasz Wasilczyk | b424da7 | 2018-11-15 11:52:57 -0800 | [diff] [blame] | 1262 | if (mode_id == feature_flags::chip_mode_ids::kV1Sta) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1263 | success = mode_controller_.lock()->changeFirmwareMode(IfaceType::STA); |
Tomasz Wasilczyk | b424da7 | 2018-11-15 11:52:57 -0800 | [diff] [blame] | 1264 | } else if (mode_id == feature_flags::chip_mode_ids::kV1Ap) { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1265 | success = mode_controller_.lock()->changeFirmwareMode(IfaceType::AP); |
| 1266 | } |
| 1267 | if (!success) { |
| 1268 | return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); |
| 1269 | } |
| 1270 | legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->start(); |
| 1271 | if (legacy_status != legacy_hal::WIFI_SUCCESS) { |
| 1272 | LOG(ERROR) << "Failed to start legacy HAL: " |
| 1273 | << legacyErrorToString(legacy_status); |
| 1274 | return createWifiStatusFromLegacyError(legacy_status); |
| 1275 | } |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1276 | // Every time the HAL is restarted, we need to register the |
| 1277 | // radio mode change callback. |
| 1278 | WifiStatus status = registerRadioModeChangeCallback(); |
| 1279 | if (status.code != WifiStatusCode::SUCCESS) { |
| 1280 | // This probably is not a critical failure? |
| 1281 | LOG(ERROR) << "Failed to register radio mode change callback"; |
| 1282 | } |
chenpaul | f5eca29 | 2019-03-14 11:08:03 +0800 | [diff] [blame] | 1283 | // Extract and save the version information into property. |
| 1284 | std::pair<WifiStatus, IWifiChip::ChipDebugInfo> version_info; |
| 1285 | version_info = WifiChip::requestChipDebugInfoInternal(); |
| 1286 | if (WifiStatusCode::SUCCESS == version_info.first.code) { |
| 1287 | property_set("vendor.wlan.firmware.version", |
| 1288 | version_info.second.firmwareDescription.c_str()); |
| 1289 | property_set("vendor.wlan.driver.version", |
| 1290 | version_info.second.driverDescription.c_str()); |
| 1291 | } |
| 1292 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1293 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 2c06a3f | 2016-12-15 17:51:40 -0800 | [diff] [blame] | 1294 | } |
Roshan Pius | 48185b2 | 2016-12-15 19:10:30 -0800 | [diff] [blame] | 1295 | |
| 1296 | WifiStatus WifiChip::registerDebugRingBufferCallback() { |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1297 | if (debug_ring_buffer_cb_registered_) { |
| 1298 | return createWifiStatus(WifiStatusCode::SUCCESS); |
Roshan Pius | 48185b2 | 2016-12-15 19:10:30 -0800 | [diff] [blame] | 1299 | } |
Roshan Pius | 3797e18 | 2017-03-30 18:01:54 -0700 | [diff] [blame] | 1300 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1301 | android::wp<WifiChip> weak_ptr_this(this); |
| 1302 | const auto& on_ring_buffer_data_callback = |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1303 | [weak_ptr_this](const std::string& name, |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1304 | const std::vector<uint8_t>& data, |
| 1305 | const legacy_hal::wifi_ring_buffer_status& status) { |
| 1306 | const auto shared_ptr_this = weak_ptr_this.promote(); |
| 1307 | if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { |
| 1308 | LOG(ERROR) << "Callback invoked on an invalid object"; |
| 1309 | return; |
| 1310 | } |
| 1311 | WifiDebugRingBufferStatus hidl_status; |
| 1312 | if (!hidl_struct_util::convertLegacyDebugRingBufferStatusToHidl( |
| 1313 | status, &hidl_status)) { |
| 1314 | LOG(ERROR) << "Error converting ring buffer status"; |
| 1315 | return; |
| 1316 | } |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1317 | const auto& target = shared_ptr_this->ringbuffer_map_.find(name); |
| 1318 | if (target != shared_ptr_this->ringbuffer_map_.end()) { |
| 1319 | Ringbuffer& cur_buffer = target->second; |
| 1320 | cur_buffer.append(data); |
| 1321 | } else { |
| 1322 | LOG(ERROR) << "Ringname " << name << " not found"; |
| 1323 | return; |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1324 | } |
| 1325 | }; |
| 1326 | legacy_hal::wifi_error legacy_status = |
| 1327 | legacy_hal_.lock()->registerRingBufferCallbackHandler( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1328 | getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback); |
Roshan Pius | 48185b2 | 2016-12-15 19:10:30 -0800 | [diff] [blame] | 1329 | |
Roshan Pius | abcf78f | 2017-10-06 16:30:38 -0700 | [diff] [blame] | 1330 | if (legacy_status == legacy_hal::WIFI_SUCCESS) { |
| 1331 | debug_ring_buffer_cb_registered_ = true; |
| 1332 | } |
| 1333 | return createWifiStatusFromLegacyError(legacy_status); |
Roshan Pius | 48185b2 | 2016-12-15 19:10:30 -0800 | [diff] [blame] | 1334 | } |
| 1335 | |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1336 | WifiStatus WifiChip::registerRadioModeChangeCallback() { |
| 1337 | android::wp<WifiChip> weak_ptr_this(this); |
| 1338 | const auto& on_radio_mode_change_callback = |
| 1339 | [weak_ptr_this](const std::vector<legacy_hal::WifiMacInfo>& mac_infos) { |
| 1340 | const auto shared_ptr_this = weak_ptr_this.promote(); |
| 1341 | if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { |
| 1342 | LOG(ERROR) << "Callback invoked on an invalid object"; |
| 1343 | return; |
| 1344 | } |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 1345 | std::vector<IWifiChipEventCallback::RadioModeInfo> |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1346 | hidl_radio_mode_infos; |
| 1347 | if (!hidl_struct_util::convertLegacyWifiMacInfosToHidl( |
| 1348 | mac_infos, &hidl_radio_mode_infos)) { |
| 1349 | LOG(ERROR) << "Error converting wifi mac info"; |
| 1350 | return; |
| 1351 | } |
| 1352 | for (const auto& callback : shared_ptr_this->getEventCallbacks()) { |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 1353 | if (!callback->onRadioModeChange_1_4(hidl_radio_mode_infos) |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1354 | .isOk()) { |
Ahmed ElArabawy | fd809fc | 2019-11-15 18:19:15 -0800 | [diff] [blame] | 1355 | LOG(ERROR) << "Failed to invoke onRadioModeChange_1_4" |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1356 | << " callback on: " << toString(callback); |
| 1357 | } |
| 1358 | } |
| 1359 | }; |
| 1360 | legacy_hal::wifi_error legacy_status = |
| 1361 | legacy_hal_.lock()->registerRadioModeChangeCallbackHandler( |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1362 | getFirstActiveWlanIfaceName(), on_radio_mode_change_callback); |
Roshan Pius | 85c6441 | 2018-01-22 17:58:40 -0800 | [diff] [blame] | 1363 | return createWifiStatusFromLegacyError(legacy_status); |
| 1364 | } |
| 1365 | |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1366 | std::vector<IWifiChip::ChipIfaceCombination> |
| 1367 | WifiChip::getCurrentModeIfaceCombinations() { |
| 1368 | if (!isValidModeId(current_mode_id_)) { |
| 1369 | LOG(ERROR) << "Chip not configured in a mode yet"; |
| 1370 | return {}; |
| 1371 | } |
| 1372 | for (const auto& mode : modes_) { |
| 1373 | if (mode.id == current_mode_id_) { |
| 1374 | return mode.availableCombinations; |
| 1375 | } |
| 1376 | } |
| 1377 | CHECK(0) << "Expected to find iface combinations for current mode!"; |
| 1378 | return {}; |
| 1379 | } |
| 1380 | |
| 1381 | // Returns a map indexed by IfaceType with the number of ifaces currently |
| 1382 | // created of the corresponding type. |
| 1383 | std::map<IfaceType, size_t> WifiChip::getCurrentIfaceCombination() { |
| 1384 | std::map<IfaceType, size_t> iface_counts; |
| 1385 | iface_counts[IfaceType::AP] = ap_ifaces_.size(); |
| 1386 | iface_counts[IfaceType::NAN] = nan_ifaces_.size(); |
| 1387 | iface_counts[IfaceType::P2P] = p2p_ifaces_.size(); |
| 1388 | iface_counts[IfaceType::STA] = sta_ifaces_.size(); |
| 1389 | return iface_counts; |
| 1390 | } |
| 1391 | |
| 1392 | // This expands the provided iface combinations to a more parseable |
| 1393 | // form. Returns a vector of available combinations possible with the number |
| 1394 | // of ifaces of each type in the combination. |
| 1395 | // This method is a port of HalDeviceManager.expandIfaceCombos() from framework. |
| 1396 | std::vector<std::map<IfaceType, size_t>> WifiChip::expandIfaceCombinations( |
| 1397 | const IWifiChip::ChipIfaceCombination& combination) { |
| 1398 | uint32_t num_expanded_combos = 1; |
| 1399 | for (const auto& limit : combination.limits) { |
| 1400 | for (uint32_t i = 0; i < limit.maxIfaces; i++) { |
| 1401 | num_expanded_combos *= limit.types.size(); |
| 1402 | } |
| 1403 | } |
| 1404 | |
| 1405 | // Allocate the vector of expanded combos and reset all iface counts to 0 |
| 1406 | // in each combo. |
| 1407 | std::vector<std::map<IfaceType, size_t>> expanded_combos; |
| 1408 | expanded_combos.resize(num_expanded_combos); |
| 1409 | for (auto& expanded_combo : expanded_combos) { |
| 1410 | for (const auto type : |
| 1411 | {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) { |
| 1412 | expanded_combo[type] = 0; |
| 1413 | } |
| 1414 | } |
| 1415 | uint32_t span = num_expanded_combos; |
| 1416 | for (const auto& limit : combination.limits) { |
| 1417 | for (uint32_t i = 0; i < limit.maxIfaces; i++) { |
| 1418 | span /= limit.types.size(); |
| 1419 | for (uint32_t k = 0; k < num_expanded_combos; ++k) { |
| 1420 | const auto iface_type = |
| 1421 | limit.types[(k / span) % limit.types.size()]; |
| 1422 | expanded_combos[k][iface_type]++; |
| 1423 | } |
| 1424 | } |
| 1425 | } |
| 1426 | return expanded_combos; |
| 1427 | } |
| 1428 | |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1429 | bool WifiChip::canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces( |
| 1430 | const std::map<IfaceType, size_t>& expanded_combo, |
| 1431 | IfaceType requested_type) { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1432 | const auto current_combo = getCurrentIfaceCombination(); |
| 1433 | |
| 1434 | // Check if we have space for 1 more iface of |type| in this combo |
| 1435 | for (const auto type : |
| 1436 | {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) { |
| 1437 | size_t num_ifaces_needed = current_combo.at(type); |
| 1438 | if (type == requested_type) { |
| 1439 | num_ifaces_needed++; |
| 1440 | } |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1441 | size_t num_ifaces_allowed = expanded_combo.at(type); |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1442 | if (num_ifaces_needed > num_ifaces_allowed) { |
| 1443 | return false; |
| 1444 | } |
| 1445 | } |
| 1446 | return true; |
| 1447 | } |
| 1448 | |
| 1449 | // This method does the following: |
| 1450 | // a) Enumerate all possible iface combos by expanding the current |
| 1451 | // ChipIfaceCombination. |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1452 | // b) Check if the requested iface type can be added to the current mode |
| 1453 | // with the iface combination that is already active. |
| 1454 | bool WifiChip::canCurrentModeSupportIfaceOfTypeWithCurrentIfaces( |
| 1455 | IfaceType requested_type) { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1456 | if (!isValidModeId(current_mode_id_)) { |
| 1457 | LOG(ERROR) << "Chip not configured in a mode yet"; |
| 1458 | return false; |
| 1459 | } |
| 1460 | const auto combinations = getCurrentModeIfaceCombinations(); |
| 1461 | for (const auto& combination : combinations) { |
| 1462 | const auto expanded_combos = expandIfaceCombinations(combination); |
| 1463 | for (const auto& expanded_combo : expanded_combos) { |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1464 | if (canExpandedIfaceComboSupportIfaceOfTypeWithCurrentIfaces( |
| 1465 | expanded_combo, requested_type)) { |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1466 | return true; |
| 1467 | } |
| 1468 | } |
| 1469 | } |
| 1470 | return false; |
| 1471 | } |
| 1472 | |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1473 | // Note: This does not consider ifaces already active. It only checks if the |
| 1474 | // provided expanded iface combination can support the requested combo. |
| 1475 | bool WifiChip::canExpandedIfaceComboSupportIfaceCombo( |
| 1476 | const std::map<IfaceType, size_t>& expanded_combo, |
| 1477 | const std::map<IfaceType, size_t>& req_combo) { |
| 1478 | // Check if we have space for 1 more iface of |type| in this combo |
| 1479 | for (const auto type : |
| 1480 | {IfaceType::AP, IfaceType::NAN, IfaceType::P2P, IfaceType::STA}) { |
| 1481 | if (req_combo.count(type) == 0) { |
| 1482 | // Iface of "type" not in the req_combo. |
| 1483 | continue; |
| 1484 | } |
| 1485 | size_t num_ifaces_needed = req_combo.at(type); |
| 1486 | size_t num_ifaces_allowed = expanded_combo.at(type); |
| 1487 | if (num_ifaces_needed > num_ifaces_allowed) { |
| 1488 | return false; |
| 1489 | } |
| 1490 | } |
| 1491 | return true; |
| 1492 | } |
| 1493 | // This method does the following: |
| 1494 | // a) Enumerate all possible iface combos by expanding the current |
| 1495 | // ChipIfaceCombination. |
| 1496 | // b) Check if the requested iface combo can be added to the current mode. |
| 1497 | // Note: This does not consider ifaces already active. It only checks if the |
| 1498 | // current mode can support the requested combo. |
| 1499 | bool WifiChip::canCurrentModeSupportIfaceCombo( |
| 1500 | const std::map<IfaceType, size_t>& req_combo) { |
| 1501 | if (!isValidModeId(current_mode_id_)) { |
| 1502 | LOG(ERROR) << "Chip not configured in a mode yet"; |
| 1503 | return false; |
| 1504 | } |
| 1505 | const auto combinations = getCurrentModeIfaceCombinations(); |
| 1506 | for (const auto& combination : combinations) { |
| 1507 | const auto expanded_combos = expandIfaceCombinations(combination); |
| 1508 | for (const auto& expanded_combo : expanded_combos) { |
| 1509 | if (canExpandedIfaceComboSupportIfaceCombo(expanded_combo, |
| 1510 | req_combo)) { |
| 1511 | return true; |
| 1512 | } |
| 1513 | } |
| 1514 | } |
| 1515 | return false; |
| 1516 | } |
| 1517 | |
| 1518 | // This method does the following: |
| 1519 | // a) Enumerate all possible iface combos by expanding the current |
| 1520 | // ChipIfaceCombination. |
| 1521 | // b) Check if the requested iface type can be added to the current mode. |
| 1522 | bool WifiChip::canCurrentModeSupportIfaceOfType(IfaceType requested_type) { |
| 1523 | // Check if we can support atleast 1 iface of type. |
| 1524 | std::map<IfaceType, size_t> req_iface_combo; |
| 1525 | req_iface_combo[requested_type] = 1; |
| 1526 | return canCurrentModeSupportIfaceCombo(req_iface_combo); |
| 1527 | } |
| 1528 | |
Roshan Pius | cc33820 | 2017-11-02 13:54:09 -0700 | [diff] [blame] | 1529 | bool WifiChip::isValidModeId(ChipModeId mode_id) { |
| 1530 | for (const auto& mode : modes_) { |
| 1531 | if (mode.id == mode_id) { |
| 1532 | return true; |
| 1533 | } |
| 1534 | } |
| 1535 | return false; |
| 1536 | } |
| 1537 | |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1538 | bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() { |
| 1539 | // Check if we can support atleast 1 STA & 1 AP concurrently. |
| 1540 | std::map<IfaceType, size_t> req_iface_combo; |
| 1541 | req_iface_combo[IfaceType::AP] = 1; |
| 1542 | req_iface_combo[IfaceType::STA] = 1; |
| 1543 | return canCurrentModeSupportIfaceCombo(req_iface_combo); |
| 1544 | } |
| 1545 | |
James Mattis | d2e4c07 | 2019-05-22 16:14:48 -0700 | [diff] [blame] | 1546 | bool WifiChip::isDualApAllowedInCurrentMode() { |
| 1547 | // Check if we can support atleast 1 STA & 1 AP concurrently. |
| 1548 | std::map<IfaceType, size_t> req_iface_combo; |
| 1549 | req_iface_combo[IfaceType::AP] = 2; |
| 1550 | return canCurrentModeSupportIfaceCombo(req_iface_combo); |
| 1551 | } |
| 1552 | |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1553 | std::string WifiChip::getFirstActiveWlanIfaceName() { |
Roshan Pius | 444473f | 2019-04-19 08:41:20 -0700 | [diff] [blame] | 1554 | if (sta_ifaces_.size() > 0) return sta_ifaces_[0]->getName(); |
| 1555 | if (ap_ifaces_.size() > 0) return ap_ifaces_[0]->getName(); |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1556 | // This could happen if the chip call is made before any STA/AP |
| 1557 | // iface is created. Default to wlan0 for such cases. |
Roshan Pius | 444473f | 2019-04-19 08:41:20 -0700 | [diff] [blame] | 1558 | LOG(WARNING) << "No active wlan interfaces in use! Using default"; |
Roshan Pius | 6036c02 | 2019-03-27 10:41:58 -0700 | [diff] [blame] | 1559 | return getWlanIfaceName(0); |
| 1560 | } |
| 1561 | |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1562 | // Return the first wlan (wlan0, wlan1 etc.) starting from |start_idx| |
| 1563 | // not already in use. |
| 1564 | // Note: This doesn't check the actual presence of these interfaces. |
| 1565 | std::string WifiChip::allocateApOrStaIfaceName(uint32_t start_idx) { |
| 1566 | for (unsigned idx = start_idx; idx < kMaxWlanIfaces; idx++) { |
| 1567 | const auto ifname = getWlanIfaceName(idx); |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 1568 | if (findUsingName(ap_ifaces_, ifname)) continue; |
| 1569 | if (findUsingName(sta_ifaces_, ifname)) continue; |
| 1570 | return ifname; |
Roshan Pius | 8e3c7ef | 2017-11-03 09:43:08 -0700 | [diff] [blame] | 1571 | } |
| 1572 | // This should never happen. We screwed up somewhere if it did. |
Tomasz Wasilczyk | 77401d3 | 2018-12-20 12:42:54 -0800 | [diff] [blame] | 1573 | CHECK(false) << "All wlan interfaces in use already!"; |
Roshan Pius | 8e3c7ef | 2017-11-03 09:43:08 -0700 | [diff] [blame] | 1574 | return {}; |
| 1575 | } |
| 1576 | |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1577 | // AP iface names start with idx 1 for modes supporting |
James Mattis | d2e4c07 | 2019-05-22 16:14:48 -0700 | [diff] [blame] | 1578 | // concurrent STA and not dual AP, else start with idx 0. |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1579 | std::string WifiChip::allocateApIfaceName() { |
James Mattis | d2e4c07 | 2019-05-22 16:14:48 -0700 | [diff] [blame] | 1580 | return allocateApOrStaIfaceName((isStaApConcurrencyAllowedInCurrentMode() && |
| 1581 | !isDualApAllowedInCurrentMode()) |
| 1582 | ? 1 |
| 1583 | : 0); |
Roshan Pius | a3e5b7f | 2019-03-25 13:52:45 -0700 | [diff] [blame] | 1584 | } |
| 1585 | |
| 1586 | // STA iface names start with idx 0. |
| 1587 | // Primary STA iface will always be 0. |
| 1588 | std::string WifiChip::allocateStaIfaceName() { |
| 1589 | return allocateApOrStaIfaceName(0); |
| 1590 | } |
| 1591 | |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1592 | bool WifiChip::writeRingbufferFilesInternal() { |
| 1593 | if (!removeOldFilesInternal()) { |
| 1594 | LOG(ERROR) << "Error occurred while deleting old tombstone files"; |
| 1595 | return false; |
| 1596 | } |
| 1597 | // write ringbuffers to file |
| 1598 | for (const auto& item : ringbuffer_map_) { |
| 1599 | const Ringbuffer& cur_buffer = item.second; |
| 1600 | if (cur_buffer.getData().empty()) { |
| 1601 | continue; |
| 1602 | } |
| 1603 | const std::string file_path_raw = |
| 1604 | kTombstoneFolderPath + item.first + "XXXXXXXXXX"; |
| 1605 | const int dump_fd = mkstemp(makeCharVec(file_path_raw).data()); |
| 1606 | if (dump_fd == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 1607 | PLOG(ERROR) << "create file failed"; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1608 | return false; |
| 1609 | } |
| 1610 | unique_fd file_auto_closer(dump_fd); |
| 1611 | for (const auto& cur_block : cur_buffer.getData()) { |
| 1612 | if (write(dump_fd, cur_block.data(), |
| 1613 | sizeof(cur_block[0]) * cur_block.size()) == -1) { |
Elliott Hughes | 4db4add | 2019-03-08 12:42:57 -0800 | [diff] [blame] | 1614 | PLOG(ERROR) << "Error writing to file"; |
xshu | 5899e8e | 2018-01-09 15:36:03 -0800 | [diff] [blame] | 1615 | } |
| 1616 | } |
| 1617 | } |
| 1618 | return true; |
| 1619 | } |
| 1620 | |
Roshan Pius | 79a9975 | 2016-10-04 13:03:58 -0700 | [diff] [blame] | 1621 | } // namespace implementation |
Ahmed ElArabawy | f501a98 | 2019-07-23 15:02:22 -0700 | [diff] [blame] | 1622 | } // namespace V1_4 |
Roshan Pius | 3c4e8a3 | 2016-10-03 14:53:58 -0700 | [diff] [blame] | 1623 | } // namespace wifi |
| 1624 | } // namespace hardware |
| 1625 | } // namespace android |