WifiNative.java revision f2e03411f137f55940a8f3592e96a272585bd7dd
1155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande/* 2155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Copyright (C) 2008 The Android Open Source Project 3155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 4155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Licensed under the Apache License, Version 2.0 (the "License"); 5155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * you may not use this file except in compliance with the License. 6155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * You may obtain a copy of the License at 7155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 8155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * http://www.apache.org/licenses/LICENSE-2.0 9155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 10155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Unless required by applicable law or agreed to in writing, software 11155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * distributed under the License is distributed on an "AS IS" BASIS, 12155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * See the License for the specific language governing permissions and 14155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * limitations under the License. 15155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 16155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 17155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepackage com.android.server.wifi; 18155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 1968cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wangimport android.annotation.Nullable; 20e1dab7a2e3ab5911f812a302b4beed1f6eb5aba7Paul Jensenimport android.net.apf.ApfCapabilities; 2170603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wangimport android.net.wifi.IApInterface; 2270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wangimport android.net.wifi.IClientInterface; 23143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpandeimport android.net.wifi.RttManager; 2468cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wangimport android.net.wifi.RttManager.ResponderConfig; 25e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapndeimport android.net.wifi.ScanResult; 26dd490cf1df37b70a8625dc4ec8e712f740dd1e4aPierre Vandwalleimport android.net.wifi.WifiConfiguration; 27aabe7a9f2f32915fd1f25416a6d2034a844005d6vandwalleimport android.net.wifi.WifiLinkLayerStats; 28e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapndeimport android.net.wifi.WifiScanner; 292a6d76f0899289cd3b96e3428f02076fdbc0363eMitchell Willsimport android.net.wifi.WifiWakeReasonAndCounts; 30f22d23092ab37286a5ef9d257d5bb32c421d2669vandwalleimport android.os.SystemClock; 31155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport android.util.Log; 32a26a8b33616c94859ba33f33403794cf636baa54Roshan Piusimport android.util.SparseArray; 33fbb081b7c28c18f0644701061a1ab38a4627db27Bartosz Fabianowski 3409b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawalimport com.android.internal.annotations.Immutable; 350fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawalimport com.android.internal.util.HexDump; 36c55e88163b223db0ca6a99ed6ffe91845c30a576Prerepa Viswanadhamimport com.android.server.connectivity.KeepalivePacketData; 37590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tanimport com.android.server.wifi.util.FrameParser; 38fbb081b7c28c18f0644701061a1ab38a4627db27Bartosz Fabianowski 390fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawalimport java.io.PrintWriter; 400fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawalimport java.io.StringWriter; 415cfd8d8b9f241dcad874125a1b5538ee0d6860fexinheimport java.nio.ByteBuffer; 425cfd8d8b9f241dcad874125a1b5538ee0d6860fexinheimport java.nio.CharBuffer; 435cfd8d8b9f241dcad874125a1b5538ee0d6860fexinheimport java.nio.charset.CharacterCodingException; 445cfd8d8b9f241dcad874125a1b5538ee0d6860fexinheimport java.nio.charset.CharsetDecoder; 455cfd8d8b9f241dcad874125a1b5538ee0d6860fexinheimport java.nio.charset.StandardCharsets; 46eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawalimport java.text.SimpleDateFormat; 47155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandeimport java.util.ArrayList; 48eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawalimport java.util.Date; 49fbb081b7c28c18f0644701061a1ab38a4627db27Bartosz Fabianowskiimport java.util.Map; 501bf983a4211f547593a60523e43112ecdb5c8997Roshan Piusimport java.util.Objects; 519ec71f6499e0e3d6f52310a41ff4a59d2fa4f8b2Mitchell Willsimport java.util.Set; 52eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawalimport java.util.TimeZone; 5318786eca942042388748b0d98979f21c9dff4a89Mitchell Wills 54fbb081b7c28c18f0644701061a1ab38a4627db27Bartosz Fabianowski 55155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande/** 56155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Native calls for bring up/shut down of the supplicant daemon and for 57155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * sending requests to the supplicant daemon 58155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 59155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * {@hide} 60155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 61155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpandepublic class WifiNative { 6218786eca942042388748b0d98979f21c9dff4a89Mitchell Wills private final String mTAG; 6318786eca942042388748b0d98979f21c9dff4a89Mitchell Wills private final String mInterfaceName; 64b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius private final SupplicantStaIfaceHal mSupplicantStaIfaceHal; 65b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius private final WifiVendorHal mWifiVendorHal; 66b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius private final WificondControl mWificondControl; 67b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 68b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public WifiNative(String interfaceName, WifiVendorHal vendorHal, 69163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius SupplicantStaIfaceHal staIfaceHal, WificondControl condControl) { 70155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande mTAG = "WifiNative-" + interfaceName; 71b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mInterfaceName = interfaceName; 72b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mWifiVendorHal = vendorHal; 73b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal = staIfaceHal; 74b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mWificondControl = condControl; 75155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 76155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 7718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public String getInterfaceName() { 7818786eca942042388748b0d98979f21c9dff4a89Mitchell Wills return mInterfaceName; 79e26ad459b63271548abbdeba4f8d77fcca9f88bdxinhe } 80e26ad459b63271548abbdeba4f8d77fcca9f88bdxinhe 81b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 82b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Enable verbose logging for all sub modules. 83b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 84b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public void enableVerboseLogging(int verbose) { 85b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mWificondControl.enableVerboseLogging(verbose > 0 ? true : false); 86b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal.enableVerboseLogging(verbose > 0); 87b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mWifiVendorHal.enableVerboseLogging(verbose > 0); 88ed9938883ae2dade81c8be6cd6ceaef3febd5239vandwalle } 89ed9938883ae2dade81c8be6cd6ceaef3febd5239vandwalle 90b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /******************************************************** 91b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Native Initialization/Deinitialization 92b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ********************************************************/ 93155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 9470603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang /** 953a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * Setup wifi native for Client mode operations. 963a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 973a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1. Starts the Wifi HAL and configures it in client/STA mode. 983a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 2. Setup Wificond to operate in client mode and retrieve the handle to use for client 993a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * operations. 1003a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 10170603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * @return An IClientInterface as wificond client interface binder handler. 10270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * Returns null on failure. 10370603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang */ 1043a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius public IClientInterface setupForClientMode() { 10570603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang if (!startHal(true)) { 10670603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang // TODO(b/34859006): Handle failures. 107b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "Failed to start HAL for client mode"); 10870603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 1093a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius return mWificondControl.setupDriverForClientMode(); 11070603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 111155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 11270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang /** 1133a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * Setup wifi native for AP mode operations. 1143a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1153a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1. Starts the Wifi HAL and configures it in AP mode. 1163a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 2. Setup Wificond to operate in AP mode and retrieve the handle to use for ap operations. 1173a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1183a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * @return An IApInterface as wificond Ap interface binder handler. 1193a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * Returns null on failure. 1203a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius */ 1213a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius public IApInterface setupForSoftApMode() { 12270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang if (!startHal(false)) { 12370603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang // TODO(b/34859006): Handle failures. 124b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "Failed to start HAL for AP mode"); 12570603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 1263a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius return mWificondControl.setupDriverForSoftApMode(); 12770603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 12870603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang 12970603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang /** 1303a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * Teardown all mode configurations in wifi native. 1313a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1323a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1. Tears down all the interfaces from Wificond. 1333a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 2. Stops the Wifi HAL. 1343a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * 1353a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius * @return Returns true on success. 1363a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius */ 1373a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius public boolean tearDown() { 1383a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius if (!mWificondControl.tearDownInterfaces()) { 1393a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius // TODO(b/34859006): Handle failures. 140b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "Failed to teardown interfaces from Wificond"); 1413a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius return false; 1423a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius } 1433a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius stopHal(); 1443a0679d411c5eb889d38ed32181446c82d5bd825Roshan Pius return true; 14570603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 14670603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang 147b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /******************************************************** 148b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Wificond operations 149b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ********************************************************/ 150b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 151b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Result of a signal poll. 152b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 153b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public static class SignalPollResult { 154b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // RSSI value in dBM. 155b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int currentRssi; 156b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius //Transmission bit rate in Mbps. 157b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int txBitrate; 158b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Association frequency in MHz. 159b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int associationFrequency; 160b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } 161b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 162b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 163b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * WiFi interface transimission counters. 164b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 165b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public static class TxPacketCounters { 166b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Number of successfully transmitted packets. 167b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int txSucceeded; 168b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Number of tramsmission failures. 169b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int txFailed; 170b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } 171b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 17270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang /** 17370603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * Disable wpa_supplicant via wificond. 17470603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * @return Returns true on success. 17570603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang */ 17670603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang public boolean disableSupplicant() { 17770603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang return mWificondControl.disableSupplicant(); 17870603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 17970603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang 18070603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang /** 18170603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * Enable wpa_supplicant via wificond. 18270603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang * @return Returns true on success. 18370603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang */ 18470603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang public boolean enableSupplicant() { 18570603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang return mWificondControl.enableSupplicant(); 18670603901b67c48202ecbb1818e59d487bbcceedaNingyuan Wang } 18718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills 188d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang /** 189d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Request signal polling to wificond. 190d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Returns an SignalPollResult object. 191d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Returns null on failure. 192d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang */ 193d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang public SignalPollResult signalPoll() { 194d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang return mWificondControl.signalPoll(); 195d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang } 196d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang 197d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang /** 198d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Fetch TX packet counters on current connection from wificond. 199d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Returns an TxPacketCounters object. 200d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang * Returns null on failure. 201d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang */ 202d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang public TxPacketCounters getTxPacketCounters() { 203d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang return mWificondControl.getTxPacketCounters(); 204d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang } 205d45b46b01f8562219468291bdc19363f0540ced0Ningyuan Wang 20624250365afbd9a20b2e03364eddf2025c8f1138aRoshan Pius /** 207b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start a scan using wificond for the given parameters. 208b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param freqs list of frequencies to scan for, if null scan all supported channels. 209b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param hiddenNetworkSSIDs List of hidden networks to be scanned for. 210b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Returns true on success. 21124250365afbd9a20b2e03364eddf2025c8f1138aRoshan Pius */ 212b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean scan(Set<Integer> freqs, Set<String> hiddenNetworkSSIDs) { 213b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWificondControl.scan(freqs, hiddenNetworkSSIDs); 214155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 215155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 21618786eca942042388748b0d98979f21c9dff4a89Mitchell Wills /** 217b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Fetch the latest scan result from kernel via wificond. 218b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Returns an ArrayList of ScanDetail. 219b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Returns an empty ArrayList on failure. 22018786eca942042388748b0d98979f21c9dff4a89Mitchell Wills */ 221b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public ArrayList<ScanDetail> getScanResults() { 222b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWificondControl.getScanResults(); 223155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 224155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 225b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 226b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start PNO scan. 227b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param pnoSettings Pno scan configuration. 228b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success. 22918786eca942042388748b0d98979f21c9dff4a89Mitchell Wills */ 230b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean startPnoScan(PnoSettings pnoSettings) { 231b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWificondControl.startPnoScan(pnoSettings); 232155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 233155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 234b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 235b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Stop PNO scan. 236b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success. 237b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 238b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean stopPnoScan() { 239b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWificondControl.stopPnoScan(); 24018786eca942042388748b0d98979f21c9dff4a89Mitchell Wills } 24118786eca942042388748b0d98979f21c9dff4a89Mitchell Wills 242b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /******************************************************** 243b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Supplicant operations 244b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ********************************************************/ 245f3aae0be78cd02f5fedd7d99b73536d2c799b030Roshan Pius 246f3aae0be78cd02f5fedd7d99b73536d2c799b030Roshan Pius /** 247b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * This method is called repeatedly until the connection to wpa_supplicant is established. 248f3aae0be78cd02f5fedd7d99b73536d2c799b030Roshan Pius * 249b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if connection is established, false otherwise. 250b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * TODO: Add unit tests for these once we remove the legacy code. 251f3aae0be78cd02f5fedd7d99b73536d2c799b030Roshan Pius */ 252163f9765f9e4c3f868b1e0d630b6adeaa115fb4aRoshan Pius public boolean connectToSupplicant() { 253b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Start initialization if not already started. 254b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (!mSupplicantStaIfaceHal.isInitializationStarted() 255b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && !mSupplicantStaIfaceHal.initialize()) { 256b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 2575cf97c9b13cc06554c8901e63d55ba051b7e7881Roshan Pius } 258b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Check if the initialization is complete. 259b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.isInitializationComplete(); 260ad7319939c424d42fa6a3791c47f613db8ef3cd8vandwalle } 261ad7319939c424d42fa6a3791c47f613db8ef3cd8vandwalle 262b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 263b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Close supplicant connection. 264ed6a985c7b63e295248fa7e8292c99b48b7a4283Mitchell Wills */ 265b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public void closeSupplicantConnection() { 266b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Nothing to do for HIDL. 267155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 268155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 269782eac0bacec797262eb4d721ad58cfcf2fbf885Tomasz Wiszkowski /** 270b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set supplicant log level 271782eac0bacec797262eb4d721ad58cfcf2fbf885Tomasz Wiszkowski * 272b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param turnOnVerbose Whether to turn on verbose logging or not. 273782eac0bacec797262eb4d721ad58cfcf2fbf885Tomasz Wiszkowski */ 274b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public void setSupplicantLogLevel(boolean turnOnVerbose) { 275f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius mSupplicantStaIfaceHal.setLogLevel(turnOnVerbose); 276e3831b70d4a8a967fe8df5496d542a432692c434Roshan Pius } 277e3831b70d4a8a967fe8df5496d542a432692c434Roshan Pius 27838a6c1ba5d461b8c7b11685c5dd2e98d9e106b55Roshan Pius /** 279b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Trigger a reconnection if the iface is disconnected. 280b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 281b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 28238a6c1ba5d461b8c7b11685c5dd2e98d9e106b55Roshan Pius */ 283b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean reconnect() { 284b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.reconnect(); 285f22d23092ab37286a5ef9d257d5bb32c421d2669vandwalle } 2869d7489491984e86915b2cf4fac38a882de1c8cdbRoshan Pius 2879d7489491984e86915b2cf4fac38a882de1c8cdbRoshan Pius /** 288b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Trigger a reassociation even if the iface is currently connected. 289b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 290b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 2919d7489491984e86915b2cf4fac38a882de1c8cdbRoshan Pius */ 292155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean reassociate() { 293b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.reassociate(); 294155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 295155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 296155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 297b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Trigger a disconnection from the currently connected network. 298b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 299b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 300b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 301b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean disconnect() { 302b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.disconnect(); 30377f2b82a2e80af8da52c22d69a76def6d4209757Jan Nordqvist } 30477f2b82a2e80af8da52c22d69a76def6d4209757Jan Nordqvist 305155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 306b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Makes a callback to HIDL to getMacAddress from supplicant 307b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 308b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return string containing the MAC address, or null on a failed call 309b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 310b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public String getMacAddress() { 311b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.getMacAddress(); 312446db2d5457456743e4476029e14d7c3bb9f5bccYuhao Zheng } 313446db2d5457456743e4476029e14d7c3bb9f5bccYuhao Zheng 314f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius public static final int RX_FILTER_TYPE_V4_MULTICAST = 0; 315f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius public static final int RX_FILTER_TYPE_V6_MULTICAST = 1; 316155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 317155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Start filtering out Multicast V4 packets 318155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * @return {@code true} if the operation succeeded, {@code false} otherwise 319155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 320155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Multicast filtering rules work as follows: 321155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 322155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * The driver can filter multicast (v4 and/or v6) and broadcast packets when in 323155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * a power optimized mode (typically when screen goes off). 324155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 325155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * In order to prevent the driver from filtering the multicast/broadcast packets, we have to 326155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * add a DRIVER RXFILTER-ADD rule followed by DRIVER RXFILTER-START to make the rule effective 327155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 328155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * DRIVER RXFILTER-ADD Num 329155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * where Num = 0 - Unicast, 1 - Broadcast, 2 - Mutil4 or 3 - Multi6 330155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 331155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * and DRIVER RXFILTER-START 332155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * In order to stop the usage of these rules, we do 333155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 334155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * DRIVER RXFILTER-STOP 335155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * DRIVER RXFILTER-REMOVE Num 336155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * where Num is as described for RXFILTER-ADD 337155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 338155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * The SETSUSPENDOPT driver command overrides the filtering rules 339155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 340155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean startFilteringMulticastV4Packets() { 341b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.stopRxFilter() 342b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.removeRxFilter( 343f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius RX_FILTER_TYPE_V4_MULTICAST) 344b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.startRxFilter(); 345155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 346155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 347155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 348155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Stop filtering out Multicast V4 packets. 349155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * @return {@code true} if the operation succeeded, {@code false} otherwise 350155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 351155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean stopFilteringMulticastV4Packets() { 352b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.stopRxFilter() 353b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.addRxFilter( 354f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius RX_FILTER_TYPE_V4_MULTICAST) 355b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.startRxFilter(); 356155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 357155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 358155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 359155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Start filtering out Multicast V6 packets 360155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * @return {@code true} if the operation succeeded, {@code false} otherwise 361155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 362155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean startFilteringMulticastV6Packets() { 363b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.stopRxFilter() 364b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.removeRxFilter( 365f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius RX_FILTER_TYPE_V6_MULTICAST) 366b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.startRxFilter(); 367155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 368155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 369155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 370155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Stop filtering out Multicast V6 packets. 371155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * @return {@code true} if the operation succeeded, {@code false} otherwise 372155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 373155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean stopFilteringMulticastV6Packets() { 374b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.stopRxFilter() 375b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.addRxFilter( 376f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius RX_FILTER_TYPE_V6_MULTICAST) 377b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && mSupplicantStaIfaceHal.startRxFilter(); 378155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 379155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 380f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius public static final int BLUETOOTH_COEXISTENCE_MODE_ENABLED = 0; 381f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius public static final int BLUETOOTH_COEXISTENCE_MODE_DISABLED = 1; 382f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius public static final int BLUETOOTH_COEXISTENCE_MODE_SENSE = 2; 3837ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde /** 3847ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * Sets the bluetooth coexistence mode. 3857ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * 3867ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * @param mode One of {@link #BLUETOOTH_COEXISTENCE_MODE_DISABLED}, 3877ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * {@link #BLUETOOTH_COEXISTENCE_MODE_ENABLED}, or 3887ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * {@link #BLUETOOTH_COEXISTENCE_MODE_SENSE}. 3897ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde * @return Whether the mode was successfully set. 3907ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde */ 391155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setBluetoothCoexistenceMode(int mode) { 392f2e03411f137f55940a8f3592e96a272585bd7ddRoshan Pius return mSupplicantStaIfaceHal.setBtCoexistenceMode(mode); 393155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 394155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 395155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 396155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * Enable or disable Bluetooth coexistence scan mode. When this mode is on, 397155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * some of the low-level scan parameters used by the driver are changed to 398155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * reduce interference with A2DP streaming. 399155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * 400cc180872c51908b15ce5cbf834634ff323e036bcChristopher Wiley * @param setCoexScanMode whether to enable or disable this mode 401155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande * @return {@code true} if the command succeeded, {@code false} otherwise. 402155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 403155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setBluetoothCoexistenceScanMode(boolean setCoexScanMode) { 404b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setBtCoexistenceScanModeEnabled(setCoexScanMode); 405155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 406155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 407b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 408b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Enable or disable suspend mode optimizations. 409b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 410b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param enabled true to enable, false otherwise. 411b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 412b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 413155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setSuspendOptimizations(boolean enabled) { 414b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setSuspendModeEnabled(enabled); 415155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 416155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 4179153bd67d51b305ffdd61355e0748e3c332c2cafRoshan Pius /** 418b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set country code. 419b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 420b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param countryCode 2 byte ASCII string. For ex: US, CA. 421b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 4229153bd67d51b305ffdd61355e0748e3c332c2cafRoshan Pius */ 423b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setCountryCode(String countryCode) { 424b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setCountryCode(countryCode); 42504c453c2e07efc30b99528926f205740226f1c7bNingyuan Wang } 42604c453c2e07efc30b99528926f205740226f1c7bNingyuan Wang 42704c453c2e07efc30b99528926f205740226f1c7bNingyuan Wang /** 428b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Initiate TDLS discover and setup or teardown with the specified peer. 429b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 430b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param macAddr MAC Address of the peer. 431b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param enable true to start discovery and setup, false to teardown. 43204c453c2e07efc30b99528926f205740226f1c7bNingyuan Wang */ 433155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void startTdls(String macAddr, boolean enable) { 434b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (enable) { 435b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal.initiateTdlsDiscover(macAddr); 436b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal.initiateTdlsSetup(macAddr); 437155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } else { 438b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal.initiateTdlsTeardown(macAddr); 439155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 440155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 441155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 442b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 443b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start WPS pin display operation with the specified peer. 444b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 445b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param bssid BSSID of the peer. 446b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 447b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 448155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean startWpsPbc(String bssid) { 449b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.startWpsPbc(bssid); 450155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 451155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 452b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 453b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start WPS pin keypad operation with the specified pin. 454b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 455b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param pin Pin to be used. 456b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 457b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 458155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean startWpsPinKeypad(String pin) { 459b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.startWpsPinKeypad(pin); 460155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 461155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 462b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 463b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start WPS pin display operation with the specified peer. 464b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 465b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param bssid BSSID of the peer. 466b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return new pin generated on success, null otherwise. 467b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 468155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public String startWpsPinDisplay(String bssid) { 469b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.startWpsPinDisplay(bssid); 470155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 471155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 472b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 473b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Sets whether to use external sim for SIM/USIM processing. 474b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 475b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param external true to enable, false otherwise. 476b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 477b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 47833b575ca6bee66183929f9474b5a161432918604Vinit Deshpande public boolean setExternalSim(boolean external) { 479b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setExternalSim(external); 48033b575ca6bee66183929f9474b5a161432918604Vinit Deshpande } 48133b575ca6bee66183929f9474b5a161432918604Vinit Deshpande 482b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 483b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Sim auth response types. 484b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 485b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public static final String SIM_AUTH_RESP_TYPE_GSM_AUTH = "GSM-AUTH"; 486b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public static final String SIM_AUTH_RESP_TYPE_UMTS_AUTH = "UMTS-AUTH"; 487b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public static final String SIM_AUTH_RESP_TYPE_UMTS_AUTS = "UMTS-AUTS"; 488b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 489b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 490b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Send the sim auth response for the currently configured network. 491b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 492b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param type |GSM-AUTH|, |UMTS-AUTH| or |UMTS-AUTS|. 493b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param response Response params. 494b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if succeeds, false otherwise. 495b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 496f97140d51d14ce0659d381f443c08dbd94dfea28Honore Tricot public boolean simAuthResponse(int id, String type, String response) { 497b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (SIM_AUTH_RESP_TYPE_GSM_AUTH.equals(type)) { 498b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapSimGsmAuthResponse(response); 499b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } else if (SIM_AUTH_RESP_TYPE_UMTS_AUTH.equals(type)) { 500b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapSimUmtsAuthResponse(response); 501b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } else if (SIM_AUTH_RESP_TYPE_UMTS_AUTS.equals(type)) { 502b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapSimUmtsAutsResponse(response); 5035cf97c9b13cc06554c8901e63d55ba051b7e7881Roshan Pius } else { 504b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 5055cf97c9b13cc06554c8901e63d55ba051b7e7881Roshan Pius } 50633b575ca6bee66183929f9474b5a161432918604Vinit Deshpande } 50733b575ca6bee66183929f9474b5a161432918604Vinit Deshpande 508b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 509b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Send the eap sim gsm auth failure for the currently configured network. 510b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 511b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if succeeds, false otherwise. 512b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 51326eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande public boolean simAuthFailedResponse(int id) { 514b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapSimGsmAuthFailure(); 51526eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande } 51626eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande 517b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 518b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Send the eap sim umts auth failure for the currently configured network. 519b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 520b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if succeeds, false otherwise. 521b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 52226eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande public boolean umtsAuthFailedResponse(int id) { 523b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapSimUmtsAuthFailure(); 52426eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande } 52526eebecc04b55129a902d1e7b670fe05668c14faVinit Deshpande 526b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 527b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Send the eap identity response for the currently configured network. 528b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 529b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param response String to send. 530b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if succeeds, false otherwise. 531b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 532ad607d99c372160c7d4b38e755e1b47d6419856eHonore Tricot public boolean simIdentityResponse(int id, String response) { 533b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.sendCurrentNetworkEapIdentityResponse(response); 534ad607d99c372160c7d4b38e755e1b47d6419856eHonore Tricot } 535ad607d99c372160c7d4b38e755e1b47d6419856eHonore Tricot 536b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 537b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start WPS pin registrar operation with the specified peer and pin. 538b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 539b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param bssid BSSID of the peer. 540b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param pin Pin to be used. 541b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 542b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 543155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean startWpsRegistrar(String bssid, String pin) { 544b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.startWpsRegistrar(bssid, pin); 545155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 546155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 547b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 548b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Cancels any ongoing WPS requests. 549b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 550b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 551b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 552155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean cancelWps() { 553b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.cancelWps(); 554155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 555155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 556b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 557b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS device name. 558b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 559b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param name String to be set. 560b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 561b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 562155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setDeviceName(String name) { 563b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsDeviceName(name); 564155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 565155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 566b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 567b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS device type. 568b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 569b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param type Type specified as a string. Used format: <categ>-<OUI>-<subcateg> 570b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 571b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 572155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setDeviceType(String type) { 573b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsDeviceType(type); 574155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 575155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 576b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 577b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS config methods 578b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 579b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param cfg List of config methods. 580b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 581b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 582155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setConfigMethods(String cfg) { 583b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsConfigMethods(cfg); 584155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 585155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 586b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 587b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS manufacturer. 588b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 589b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param value String to be set. 590b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 591b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 592155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setManufacturer(String value) { 593b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsManufacturer(value); 594155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 595155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 596b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 597b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS model name. 598b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 599b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param value String to be set. 600b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 601b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 602155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setModelName(String value) { 603b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsModelName(value); 604155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 605155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 606b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 607b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS model number. 608b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 609b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param value String to be set. 610b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 611b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 612155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setModelNumber(String value) { 613b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsModelNumber(value); 614155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 615155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 616b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 617b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set WPS serial number. 618b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 619b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param value String to be set. 620b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 621b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 622155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public boolean setSerialNumber(String value) { 623b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setWpsSerialNumber(value); 624155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 625155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 626b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 627b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Enable or disable power save mode. 628b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 629b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param enabled true to enable, false to disable. 630b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 631155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande public void setPowerSave(boolean enabled) { 632b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mSupplicantStaIfaceHal.setPowerSave(enabled); 633155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 634155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 635b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 636b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set concurrency priority between P2P & STA operations. 637b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 638b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param isStaHigherPriority Set to true to prefer STA over P2P during concurrency operations, 639b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * false otherwise. 640b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise. 641b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 642b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setConcurrencyPriority(boolean isStaHigherPriority) { 643b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setConcurrencyPriority(isStaHigherPriority); 644155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 645155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 646155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande /** 6473e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius * Enable/Disable auto reconnect functionality in wpa_supplicant. 6483e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius * 6493e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius * @param enable true to enable auto reconnecting, false to disable. 6503e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius * @return true if request is sent successfully, false otherwise. 6513e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius */ 6523e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius public boolean enableStaAutoReconnect(boolean enable) { 6533e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius return mSupplicantStaIfaceHal.enableAutoReconnect(enable); 6543e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius } 6553e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius 6563e240b2bfb6fefe8b91ad68e8a12b652b4136c69Roshan Pius /** 657b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Migrate all the configured networks from wpa_supplicant. 658b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 659b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param configs Map of configuration key to configuration objects corresponding to all 660b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * the networks. 661b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param networkExtras Map of extra configuration parameters stored in wpa_supplicant.conf 662b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Max priority of all the configs. 663155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande */ 664b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean migrateNetworksFromSupplicant(Map<String, WifiConfiguration> configs, 665b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius SparseArray<Map<String, String>> networkExtras) { 666b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.loadNetworks(configs, networkExtras); 667155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 668155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 669b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 670b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Add the provided network configuration to wpa_supplicant and initiate connection to it. 671b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * This method does the following: 672a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang * 1. Remove any existing network in wpa_supplicant(This implicitly triggers disconnect). 673a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang * 2. Add a new network to wpa_supplicant. 674a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang * 3. Save the provided configuration to wpa_supplicant. 675a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang * 4. Select the new network in wpa_supplicant. 676a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang * 5. Triggers reconnect command to wpa_supplicant. 677b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 678b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param configuration WifiConfiguration parameters for the provided network. 679b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return {@code true} if it succeeds, {@code false} otherwise 680b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 681a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang public boolean connectToNetwork(WifiConfiguration configuration) { 682a5936a61582404692c6046e3b496d3b1d22a94cbNingyuan Wang return mSupplicantStaIfaceHal.connectToNetwork(configuration); 683155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 684155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 685b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 686b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Initiates roaming to the already configured network in wpa_supplicant. If the network 687b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * configuration provided does not match the already configured network, then this triggers 688b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * a new connection attempt (instead of roam). 689b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1. First check if we're attempting to connect to the same network as we currently have 690b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * configured. 691b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 2. Set the new bssid for the network in wpa_supplicant. 692b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 3. Triggers reassociate command to wpa_supplicant. 693b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 694b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param configuration WifiConfiguration parameters for the provided network. 695b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return {@code true} if it succeeds, {@code false} otherwise 696b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 697b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean roamToNetwork(WifiConfiguration configuration) { 698b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.roamToNetwork(configuration); 699155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 700155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 701b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 702b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Get the framework network ID corresponding to the provided supplicant network ID for the 703b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * network configured in wpa_supplicant. 704b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 705b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param supplicantNetworkId network ID in wpa_supplicant for the network. 706b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Corresponding framework network ID if found, -1 if network not found. 707b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 708b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int getFrameworkNetworkId(int supplicantNetworkId) { 709b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return supplicantNetworkId; 710155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 711155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 712b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 713b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Remove all the networks. 714b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 715b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return {@code true} if it succeeds, {@code false} otherwise 716b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 717b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean removeAllNetworks() { 718b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.removeAllNetworks(); 719155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 720155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 721b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 722b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set the BSSID for the currently configured network in wpa_supplicant. 723b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 724b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if successful, false otherwise. 725b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 726b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setConfiguredNetworkBSSID(String bssid) { 727b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.setCurrentNetworkBssid(bssid); 728155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 729155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 730b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 731b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Initiate ANQP query. 732b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 733b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param bssid BSSID of the AP to be queried 734b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param anqpIds Set of anqp IDs. 735b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param hs20Subtypes Set of HS20 subtypes. 736b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success, false otherwise. 737b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 738b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean requestAnqp(String bssid, Set<Integer> anqpIds, Set<Integer> hs20Subtypes) { 739b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (bssid == null || ((anqpIds == null || anqpIds.isEmpty()) 740b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius && (hs20Subtypes == null || hs20Subtypes.isEmpty()))) { 741b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "Invalid arguments for ANQP request."); 742155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande return false; 743155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 744b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ArrayList<Short> anqpIdList = new ArrayList<>(); 745b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius for (Integer anqpId : anqpIds) { 746b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius anqpIdList.add(anqpId.shortValue()); 74761233efc46707ace6cb3a45dd84766f06df946afTomasz Wiszkowski } 748b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ArrayList<Integer> hs20SubtypeList = new ArrayList<>(); 749b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius hs20SubtypeList.addAll(hs20Subtypes); 750b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.initiateAnqpQuery(bssid, anqpIdList, hs20SubtypeList); 751155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 752155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 753b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 754b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Request a passpoint icon file |filename| from the specified AP |bssid|. 755b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param bssid BSSID of the AP 756b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param fileName name of the icon file 757b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if request is sent successfully, false otherwise 758b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 759b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean requestIcon(String bssid, String fileName) { 760b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (bssid == null || fileName == null) { 761b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "Invalid arguments for Icon request."); 76261233efc46707ace6cb3a45dd84766f06df946afTomasz Wiszkowski return false; 763155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 764b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.initiateHs20IconQuery(bssid, fileName); 765155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 766155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande 767b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 768b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Get the currently configured network's WPS NFC token. 769b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 770b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Hex string corresponding to the WPS NFC token. 771b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 772ba3f5bc64ef27f2ec0d3eae3f53c633ea9e66268Amin Shaikh public String getCurrentNetworkWpsNfcConfigurationToken() { 773b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mSupplicantStaIfaceHal.getCurrentNetworkWpsNfcConfigurationToken(); 774155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande } 775b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /******************************************************** 776b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Vendor HAL operations 777b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ********************************************************/ 778af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius /** 779af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius * Callback to notify vendor HAL death. 780af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius */ 781af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius public interface VendorHalDeathEventHandler { 782af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius /** 783af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius * Invoked when the vendor HAL dies. 784af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius */ 785af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius void onDeath(); 786af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius } 787b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 788d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius /** 789520fbe7db055661af039303c1081236c73b04abdRoshan Pius * Initializes the vendor HAL. This is just used to initialize the {@link HalDeviceManager}. 790520fbe7db055661af039303c1081236c73b04abdRoshan Pius */ 791af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius public boolean initializeVendorHal(VendorHalDeathEventHandler handler) { 792af0e32cfa2f7402c60b9df88a0d9bd19f421026cRoshan Pius return mWifiVendorHal.initialize(handler); 793520fbe7db055661af039303c1081236c73b04abdRoshan Pius } 794520fbe7db055661af039303c1081236c73b04abdRoshan Pius 795520fbe7db055661af039303c1081236c73b04abdRoshan Pius /** 796d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius * Bring up the Vendor HAL and configure for STA mode or AP mode. 797d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius * 798d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius * @param isStaMode true to start HAL in STA mode, false to start in AP mode. 799d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius */ 800d84fd37259c6e956d0f00c261f573dfa319acb91Roshan Pius public boolean startHal(boolean isStaMode) { 801b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.startVendorHal(isStaMode); 8027ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde } 8037ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde 804b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 805b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Stops the HAL 806b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 80718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public void stopHal() { 808b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius mWifiVendorHal.stopVendorHal(); 8097ef73dd1b6e43c72b3841723504cd86dc402a134Vinit Deshapnde } 8107f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 811b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 812b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Tests whether the HAL is running or not 813b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 81418786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean isHalStarted() { 815b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.isHalStarted(); 8167f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde } 8177f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 818062e3f39e37874fedc01f267de5f4cf7dbebe2b4Randy Pan // TODO: Change variable names to camel style. 819e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public static class ScanCapabilities { 820297c3acabe7a85eb87240fe3ccf772e57ce6aef7Mitchell Wills public int max_scan_cache_size; 821e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public int max_scan_buckets; 822e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public int max_ap_cache_per_scan; 823e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public int max_rssi_sample_size; 824297c3acabe7a85eb87240fe3ccf772e57ce6aef7Mitchell Wills public int max_scan_reporting_threshold; 8257d6301ead19afdf3de37455e9ed133c25b4938cdVinit Deshpande public int max_hotlist_bssids; 826e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public int max_significant_wifi_change_aps; 827d34e3a7b98d51f684100483151fceb233fd95215Roshan Pius public int max_bssid_history_entries; 828d34e3a7b98d51f684100483151fceb233fd95215Roshan Pius public int max_number_epno_networks; 829d34e3a7b98d51f684100483151fceb233fd95215Roshan Pius public int max_number_epno_networks_by_ssid; 830d34e3a7b98d51f684100483151fceb233fd95215Roshan Pius public int max_number_of_white_listed_ssid; 831e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 832e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 833b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 834b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Gets the scan capabilities 835b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 836b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param capabilities object to be filled in 837b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success. false for failure 838b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 8396ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public boolean getBgScanCapabilities(ScanCapabilities capabilities) { 8406ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass return mWifiVendorHal.getBgScanCapabilities(capabilities); 841e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 842e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 843e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public static class ChannelSettings { 844712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int frequency; 845712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int dwell_time_ms; 846712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public boolean passive; 8477f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde } 8487f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 849e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public static class BucketSettings { 850712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int bucket; 851712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int band; 852712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int period_ms; 853712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int max_period_ms; 854712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int step_count; 855712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int report_events; 856712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int num_channels; 857712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public ChannelSettings[] channels; 858e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 8597f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 8606259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius /** 8616259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius * Network parameters for hidden networks to be scanned for. 8626259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius */ 8636259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius public static class HiddenNetwork { 8646259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius public String ssid; 8656259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius 8666259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius @Override 8676259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius public boolean equals(Object otherObj) { 8686259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius if (this == otherObj) { 8696259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius return true; 8706259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius } else if (otherObj == null || getClass() != otherObj.getClass()) { 8716259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius return false; 8726259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius } 8736259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius HiddenNetwork other = (HiddenNetwork) otherObj; 8746259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius return Objects.equals(ssid, other.ssid); 8756259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius } 876ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh 877ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh @Override 878ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh public int hashCode() { 879ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh return (ssid == null ? 0 : ssid.hashCode()); 880ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh } 8816259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius } 8826259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius 883e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde public static class ScanSettings { 884712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int base_period_ms; 885712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int max_ap_per_scan; 886712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int report_threshold_percent; 887712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int report_threshold_num_scans; 888712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public int num_buckets; 8896259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius /* Not used for bg scans. Only works for single scans. */ 8906259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius public HiddenNetwork[] hiddenNetworks; 891712ef6246834caeac3d5b06bea08e85d6b29cd7aMitchell Wills public BucketSettings[] buckets; 892e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 8937f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 89468cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang /** 8959bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Network parameters to start PNO scan. 8969bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius */ 8979bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public static class PnoNetwork { 8989bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public String ssid; 8999bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public byte flags; 900ef3ea1092bc17673c0a85a845b053151b7c10e07Roshan Pius public byte auth_bit_field; 9011bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius 9021bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius @Override 9031bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius public boolean equals(Object otherObj) { 9041bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius if (this == otherObj) { 9051bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius return true; 9061bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius } else if (otherObj == null || getClass() != otherObj.getClass()) { 9071bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius return false; 9081bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius } 9091bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius PnoNetwork other = (PnoNetwork) otherObj; 9106259b630ddb59b642729a2d2113d81ed8e33a0e3Roshan Pius return ((Objects.equals(ssid, other.ssid)) && (flags == other.flags) 9111bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius && (auth_bit_field == other.auth_bit_field)); 9121bf983a4211f547593a60523e43112ecdb5c8997Roshan Pius } 913ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh 914ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh @Override 915ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh public int hashCode() { 916ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh int result = (ssid == null ? 0 : ssid.hashCode()); 917ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh result ^= ((int) flags * 31) + ((int) auth_bit_field << 8); 918ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh return result; 919ef1606e936204c56ffdae305f2f423ee3503fecdMehdi Alizadeh } 9209bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius } 9219bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius 9229bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius /** 9239bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Parameters to start PNO scan. This holds the list of networks which are going to used for 9249bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * PNO scan. 9259bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius */ 9269bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public static class PnoSettings { 9279bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int min5GHzRssi; 9289bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int min24GHzRssi; 9299bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int initialScoreMax; 9309bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int currentConnectionBonus; 9319bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int sameNetworkBonus; 9329bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int secureBonus; 9339bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public int band5GHzBonus; 93404c453c2e07efc30b99528926f205740226f1c7bNingyuan Wang public int periodInMs; 935dcd877d6c143db557884993ea437e2a432cb0ba3Roshan Pius public boolean isConnected; 9369bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public PnoNetwork[] networkList; 9379bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius } 9389bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius 939b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande public static interface ScanEventHandler { 94063539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills /** 94163539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * Called for each AP as it is found with the entire contents of the beacon/probe response. 94263539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * Only called when WifiScanner.REPORT_EVENT_FULL_SCAN_RESULT is specified. 94363539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills */ 944c9e6069eb941d282af213dc20b171877db6b567bMitchell Wills void onFullScanResult(ScanResult fullScanResult, int bucketsScanned); 94563539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills /** 94663539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * Callback on an event during a gscan scan. 94763539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * See WifiNative.WIFI_SCAN_* for possible values. 94863539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills */ 94963539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills void onScanStatus(int event); 95063539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills /** 95163539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * Called with the current cached scan results when gscan is paused. 95263539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills */ 95383a674a18c84ff4f01377bbfd8988699dec93bc2Vinit Deshpande void onScanPaused(WifiScanner.ScanData[] data); 95463539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills /** 95563539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills * Called with the current cached scan results when gscan is resumed. 95663539f1283899fbbf83ab90757961b4be51d5034Mitchell Wills */ 957b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande void onScanRestarted(); 958e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 959e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 9609bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius /** 9619bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Handler to notify the occurrence of various events during PNO scan. 9629bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius */ 9639bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public interface PnoEventHandler { 9649bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius /** 9659bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Callback to notify when one of the shortlisted networks is found during PNO scan. 9669bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * @param results List of Scan results received. 9679bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius */ 9689bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius void onPnoNetworkFound(ScanResult[] results); 969063cfc7e3eef78fcbda24a66f0c473828b39c854Roshan Pius 970063cfc7e3eef78fcbda24a66f0c473828b39c854Roshan Pius /** 971063cfc7e3eef78fcbda24a66f0c473828b39c854Roshan Pius * Callback to notify when the PNO scan schedule fails. 972063cfc7e3eef78fcbda24a66f0c473828b39c854Roshan Pius */ 973063cfc7e3eef78fcbda24a66f0c473828b39c854Roshan Pius void onPnoScanFailed(); 9749bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius } 9759bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius 97671af8bb37fee5852ae458edabdef3b487d62a5b8Mitchell Wills public static final int WIFI_SCAN_RESULTS_AVAILABLE = 0; 97771af8bb37fee5852ae458edabdef3b487d62a5b8Mitchell Wills public static final int WIFI_SCAN_THRESHOLD_NUM_SCANS = 1; 97871af8bb37fee5852ae458edabdef3b487d62a5b8Mitchell Wills public static final int WIFI_SCAN_THRESHOLD_PERCENT = 2; 97971af8bb37fee5852ae458edabdef3b487d62a5b8Mitchell Wills public static final int WIFI_SCAN_FAILED = 3; 980b7cc309f06da8a18224057c21ba086f8550367d6Vinit Deshpande 981b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 982b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Starts a background scan. 983b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Any ongoing scan will be stopped first 984b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 985b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param settings to control the scan 986b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param eventHandler to call with the results 987b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success 988b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 9896ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public boolean startBgScan(ScanSettings settings, ScanEventHandler eventHandler) { 9906ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass return mWifiVendorHal.startBgScan(settings, eventHandler); 9917f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde } 9927f9a15d554f69311a0db43347d6473a7c4c46e2eVinit Deshapnde 993b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 994b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Stops any ongoing backgound scan 995b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 9966ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public void stopBgScan() { 9976ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass mWifiVendorHal.stopBgScan(); 998b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande } 999b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande 1000b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1001b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Pauses an ongoing backgound scan 1002b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 10036ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public void pauseBgScan() { 10046ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass mWifiVendorHal.pauseBgScan(); 1005b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande } 1006b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande 1007b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1008b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Restarts a paused scan 1009b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 10106ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public void restartBgScan() { 10116ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass mWifiVendorHal.restartBgScan(); 1012e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1013e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 1014b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1015b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Gets the latest scan results received. 1016b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 10176ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass public WifiScanner.ScanData[] getBgScanResults() { 10186ba8a37de432d957e10dd9cc74798758870d02e6Michael Plass return mWifiVendorHal.getBgScanResults(); 1019e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1020e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 1021b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande public static interface HotlistEventHandler { 1022d4762401ec14be6bdd2d27aff2478ddbf8d6ce2aVinit Deshpande void onHotlistApFound (ScanResult[] result); 1023d4762401ec14be6bdd2d27aff2478ddbf8d6ce2aVinit Deshpande void onHotlistApLost (ScanResult[] result); 1024e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1025e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 102618786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean setHotlist(WifiScanner.HotlistSettings settings, 102718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills HotlistEventHandler eventHandler) { 1028b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "setHotlist not supported"); 1029b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 1030e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1031e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 103218786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public void resetHotlist() { 1033b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "resetHotlist not supported"); 1034e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1035e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 1036b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande public static interface SignificantWifiChangeEventHandler { 1037e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde void onChangesFound(ScanResult[] result); 1038e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1039e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 104018786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean trackSignificantWifiChange( 1041b0b1d59786de7ff1fc98e31a16a7d710458bf549Vinit Deshpande WifiScanner.WifiChangeSettings settings, SignificantWifiChangeEventHandler handler) { 1042b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "trackSignificantWifiChange not supported"); 1043b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 1044e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1045e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 104618786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public void untrackSignificantWifiChange() { 1047b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "untrackSignificantWifiChange not supported"); 1048e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde } 1049e4e3750390bec0a849a9153348b7c21b2cc8b843Vinit Deshapnde 105018786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public WifiLinkLayerStats getWifiLinkLayerStats(String iface) { 1051b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getWifiLinkLayerStats(); 10525c08cc119b92af69997af194cc8b6d0111e37d31Andres Morales } 10535c08cc119b92af69997af194cc8b6d0111e37d31Andres Morales 105418786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public void setWifiLinkLayerStats(String iface, int enable) { 1055b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // TODO(b//36087365) Remove this. Link layer stats is enabled when the HAL is started. 1056d745a52dc4f929d4a4030f205ed173bdf60eaf10Pierre Vandwalle } 1057d745a52dc4f929d4a4030f205ed173bdf60eaf10Pierre Vandwalle 1058b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1059b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Get the supported features 1060b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1061b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return bitmask defined by WifiManager.WIFI_FEATURE_* 1062b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 106318786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public int getSupportedFeatureSet() { 1064b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getSupportedFeatureSet(); 1065a632d8a6edd350c7644b593b18eceaa5b368505bVinit Deshpande } 1066143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande 1067143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande public static interface RttEventHandler { 1068143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande void onRttResults(RttManager.RttResult[] result); 1069143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande } 1070143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande 1071b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1072b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Starts a new rtt request 1073b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1074b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param params RTT request params. Refer to {@link RttManager#RttParams}. 1075b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param handler Callback to be invoked to notify any results. 1076b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if the request was successful, false otherwise. 1077b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 107818786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean requestRtt( 1079143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande RttManager.RttParams[] params, RttEventHandler handler) { 1080b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.requestRtt(params, handler); 1081143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande } 1082143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande 1083b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1084b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Cancels an outstanding rtt request 1085b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1086b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param params RTT request params. Refer to {@link RttManager#RttParams} 1087b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if there was an outstanding request and it was successfully cancelled 1088b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 108918786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean cancelRtt(RttManager.RttParams[] params) { 1090b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.cancelRtt(params); 1091143657392bf0702a155fe688171a5abbf4c86570Vinit Deshpande } 1092042c54bfd5144ce8e720585b2093796e7e28de5eVinit Deshpande 109368cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang /** 109468cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang * Enable RTT responder role on the device. Returns {@link ResponderConfig} if the responder 109568cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang * role is successfully enabled, {@code null} otherwise. 1096b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1097b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param timeoutSeconds timeout to use for the responder. 109868cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang */ 109968cb8c02b4ad079c54a2ffd4407da921d18c7af9Wei Wang @Nullable 1100b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public ResponderConfig enableRttResponder(int timeoutSeconds) { 1101b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.enableRttResponder(timeoutSeconds); 110212cf388ecf3b2aa5ba66ed680b931fa356ab75b5xinhe } 1103939177ff615062ec826601d536466875d8457375xinhe 1104b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1105b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Disable RTT responder role. Returns {@code true} if responder role is successfully disabled, 1106b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * {@code false} otherwise. 1107b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1108b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean disableRttResponder() { 1109b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.disableRttResponder(); 11106609df5a9c14e4440c085567a27437a8cfc50f88Paul Jensen } 11116609df5a9c14e4440c085567a27437a8cfc50f88Paul Jensen 1112b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1113b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set the MAC OUI during scanning. 1114b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * An OUI {Organizationally Unique Identifier} is a 24-bit number that 1115b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * uniquely identifies a vendor or manufacturer. 1116b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1117b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param oui OUI to set. 1118b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success 1119b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1120b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setScanningMacOui(byte[] oui) { 1121b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.setScanningMacOui(oui); 11226609df5a9c14e4440c085567a27437a8cfc50f88Paul Jensen } 11236609df5a9c14e4440c085567a27437a8cfc50f88Paul Jensen 1124b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1125b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Query the list of valid frequencies for the provided band. 1126b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * The result depends on the on the country code that has been set. 1127b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1128b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param band as specified by one of the WifiScanner.WIFI_BAND_* constants. 1129b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return frequencies vector of valid frequencies (MHz), or null for error. 1130b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @throws IllegalArgumentException if band is not recognized. 1131b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1132b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int [] getChannelsForBand(int band) { 1133b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getChannelsForBand(band); 1134939177ff615062ec826601d536466875d8457375xinhe } 1135939177ff615062ec826601d536466875d8457375xinhe 1136b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1137b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Indicates whether getChannelsForBand is supported. 1138b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1139b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true if it is. 1140b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1141b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean isGetChannelsForBandSupported() { 1142b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.isGetChannelsForBandSupported(); 1143d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1144d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1145b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1146b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set DFS - actually, this is always on. 1147b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1148b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param dfsOn 1149b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return success indication 1150b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1151b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setDfsFlag(boolean dfsOn) { 1152b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.setDfsFlag(dfsOn); 1153d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1154d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1155b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1156b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * RTT (Round Trip Time) measurement capabilities of the device. 1157b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1158b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public RttManager.RttCapabilities getRttCapabilities() { 1159b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getRttCapabilities(); 1160d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1161d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1162b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1163b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Get the APF (Android Packet Filter) capabilities of the device 1164b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1165b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public ApfCapabilities getApfCapabilities() { 1166b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getApfCapabilities(); 1167d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1168d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1169b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1170b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Installs an APF program on this iface, replacing any existing program. 1171b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1172b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param filter is the android packet filter program 1173b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success 1174b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1175b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean installPacketFilter(byte[] filter) { 1176b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.installPacketFilter(filter); 1177d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1178d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1179b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1180b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Set country code for this AP iface. 1181b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1182b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param countryCode - two-letter country code (as ISO 3166) 1183b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success 1184b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1185b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public boolean setCountryCodeHal(String countryCode) { 1186b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.setCountryCodeHal(countryCode); 1187d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe } 1188d57f630f6a7a5fca872d2b96fc4cce1905daee5dxinhe 1189a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle //--------------------------------------------------------------------------------- 1190a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle /* Wifi Logger commands/events */ 1191a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle public static interface WifiLoggerEventHandler { 11920bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande void onRingBufferData(RingBufferStatus status, byte[] buffer); 11930bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande void onWifiAlert(int errorCode, byte[] buffer); 1194a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle } 1195a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle 1196b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1197b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Registers the logger callback and enables alerts. 1198b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Ring buffer data collection is only triggered when |startLoggingRingBuffer| is invoked. 1199b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1200b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param handler Callback to be invoked. 1201b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success, false otherwise. 1202b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 120318786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean setLoggingEventHandler(WifiLoggerEventHandler handler) { 1204b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.setLoggingEventHandler(handler); 120503ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 120603ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 1207b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1208b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Control debug data collection 1209b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1210b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param verboseLevel 0 to 3, inclusive. 0 stops logging. 1211b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param flags Ignored. 1212b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param maxInterval Maximum interval between reports; ignore if 0. 1213b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param minDataSize Minimum data size in buffer for report; ignore if 0. 1214b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param ringName Name of the ring for which data collection is to start. 1215b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success, false otherwise. 1216b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 121718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean startLoggingRingBuffer(int verboseLevel, int flags, int maxInterval, 121803ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe int minDataSize, String ringName){ 1219b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.startLoggingRingBuffer( 1220b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius verboseLevel, flags, maxInterval, minDataSize, ringName); 122103ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 122203ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 1223b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1224b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Logger features exposed. 1225b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * This is a no-op now, will always return -1. 1226b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1227b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success, false otherwise. 1228b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 122918786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public int getSupportedLoggerFeatureSet() { 1230b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getSupportedLoggerFeatureSet(); 123103ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 123203ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 1233b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1234b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Stops all logging and resets the logger callback. 1235b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * This stops both the alerts and ring buffer data collection. 1236b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success, false otherwise. 1237b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 123818786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean resetLogHandler() { 1239b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.resetLogHandler(); 1240b797893fc1966803d0c013faac42e6396a37a384xinhe } 1241b797893fc1966803d0c013faac42e6396a37a384xinhe 1242b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1243b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Vendor-provided wifi driver version string 1244b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1245b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return String returned from the HAL. 1246b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 124718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public String getDriverVersion() { 1248b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getDriverVersion(); 124903ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 125003ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 1251b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1252b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Vendor-provided wifi firmware version string 1253b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1254b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return String returned from the HAL. 1255b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 125618786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public String getFirmwareVersion() { 1257b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getFirmwareVersion(); 125803ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 125903ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 12600bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande public static class RingBufferStatus{ 12610bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande String name; 12620bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int flag; 12630bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int ringBufferId; 12640bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int ringBufferByteSize; 12650bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int verboseLevel; 12660bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int writtenBytes; 12670bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int readBytes; 12680bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande int writtenRecords; 12690bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande 127053f278b6fed422a18d763b07216a21e96d9445f9Michael Plass // Bit masks for interpreting |flag| 127153f278b6fed422a18d763b07216a21e96d9445f9Michael Plass public static final int HAS_BINARY_ENTRIES = (1 << 0); 127253f278b6fed422a18d763b07216a21e96d9445f9Michael Plass public static final int HAS_ASCII_ENTRIES = (1 << 1); 127353f278b6fed422a18d763b07216a21e96d9445f9Michael Plass public static final int HAS_PER_PACKET_ENTRIES = (1 << 2); 127453f278b6fed422a18d763b07216a21e96d9445f9Michael Plass 12750bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande @Override 12760bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande public String toString() { 12770bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande return "name: " + name + " flag: " + flag + " ringBufferId: " + ringBufferId + 12780bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande " ringBufferByteSize: " +ringBufferByteSize + " verboseLevel: " +verboseLevel + 12790bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande " writtenBytes: " + writtenBytes + " readBytes: " + readBytes + 12800bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande " writtenRecords: " + writtenRecords; 12810bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande } 12820bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande } 12830bf150b2d69ec62df905bc6f8603437dc4caee1fVinit Deshpande 1284b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1285b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * API to get the status of all ring buffers supported by driver 1286b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 128718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public RingBufferStatus[] getRingBufferStatus() { 1288b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getRingBufferStatus(); 128903ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 129003ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe 1291b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1292b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Indicates to driver that all the data has to be uploaded urgently 1293b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1294b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param ringName Name of the ring buffer requested. 1295b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true on success, false otherwise. 1296b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 129718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public boolean getRingBufferData(String ringName) { 1298b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getRingBufferData(ringName); 129903ba4a5b108ab2bbdb5d0e7be46ac45c00a6d9ffxinhe } 1300127f7244183786e6ccae09e81eeccdac31973e69xinhe 1301b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1302b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Request vendor debug info from the firmware 1303b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1304b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Raw data obtained from the HAL. 1305b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 130618786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public byte[] getFwMemoryDump() { 1307b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getFwMemoryDump(); 1308a0d34d3626bd9631039a485d2d428b1b7de390e2Pierre Vandwalle } 1309dd490cf1df37b70a8625dc4ec8e712f740dd1e4aPierre Vandwalle 1310b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1311b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Request vendor debug info from the driver 1312b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1313b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return Raw data obtained from the HAL. 1314b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1315d0cb2fae195ebb9f658095667f3c7b7b8d69a204mukesh agrawal public byte[] getDriverStateDump() { 1316b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getDriverStateDump(); 1317d0cb2fae195ebb9f658095667f3c7b7b8d69a204mukesh agrawal } 1318d0cb2fae195ebb9f658095667f3c7b7b8d69a204mukesh agrawal 1319dd490cf1df37b70a8625dc4ec8e712f740dd1e4aPierre Vandwalle //--------------------------------------------------------------------------------- 132009b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal /* Packet fate API */ 132109b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 132209b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal @Immutable 132309b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal abstract static class FateReport { 1324eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final static int USEC_PER_MSEC = 1000; 1325eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // The driver timestamp is a 32-bit counter, in microseconds. This field holds the 1326eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // maximal value of a driver timestamp in milliseconds. 1327eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final static int MAX_DRIVER_TIMESTAMP_MSEC = (int) (0xffffffffL / 1000); 1328eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final static SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss.SSS"); 1329eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal 133009b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal final byte mFate; 133109b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal final long mDriverTimestampUSec; 133209b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal final byte mFrameType; 133309b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal final byte[] mFrameBytes; 1334eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final long mEstimatedWallclockMSec; 133509b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 133609b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal FateReport(byte fate, long driverTimestampUSec, byte frameType, byte[] frameBytes) { 133709b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal mFate = fate; 133809b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal mDriverTimestampUSec = driverTimestampUSec; 1339eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal mEstimatedWallclockMSec = 1340eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal convertDriverTimestampUSecToWallclockMSec(mDriverTimestampUSec); 134109b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal mFrameType = frameType; 134209b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal mFrameBytes = frameBytes; 134309b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 13440fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 1345590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan public String toTableRowString() { 1346590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan StringWriter sw = new StringWriter(); 1347590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan PrintWriter pw = new PrintWriter(sw); 1348590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan FrameParser parser = new FrameParser(mFrameType, mFrameBytes); 1349eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal dateFormatter.setTimeZone(TimeZone.getDefault()); 1350eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal pw.format("%-15s %12s %-9s %-32s %-12s %-23s %s\n", 1351eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal mDriverTimestampUSec, 1352eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal dateFormatter.format(new Date(mEstimatedWallclockMSec)), 1353eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal directionToString(), fateToString(), parser.mMostSpecificProtocolString, 1354eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal parser.mTypeString, parser.mResultString); 1355590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan return sw.toString(); 1356590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan } 1357590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan 1358590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan public String toVerboseStringWithPiiAllowed() { 13590fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal StringWriter sw = new StringWriter(); 13600fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal PrintWriter pw = new PrintWriter(sw); 1361590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan FrameParser parser = new FrameParser(mFrameType, mFrameBytes); 13620fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.format("Frame direction: %s\n", directionToString()); 13630fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.format("Frame timestamp: %d\n", mDriverTimestampUSec); 13640fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.format("Frame fate: %s\n", fateToString()); 13650fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.format("Frame type: %s\n", frameTypeToString(mFrameType)); 1366590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan pw.format("Frame protocol: %s\n", parser.mMostSpecificProtocolString); 1367590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan pw.format("Frame protocol type: %s\n", parser.mTypeString); 13680fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.format("Frame length: %d\n", mFrameBytes.length); 13690fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.append("Frame bytes"); 1370590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan pw.append(HexDump.dumpHexString(mFrameBytes)); // potentially contains PII 13710fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal pw.append("\n"); 13720fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return sw.toString(); 13730fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 13740fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 1375590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan /* Returns a header to match the output of toTableRowString(). */ 1376590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan public static String getTableHeader() { 1377590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan StringWriter sw = new StringWriter(); 1378590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan PrintWriter pw = new PrintWriter(sw); 1379eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal pw.format("\n%-15s %-12s %-9s %-32s %-12s %-23s %s\n", 1380eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal "Time usec", "Walltime", "Direction", "Fate", "Protocol", "Type", "Result"); 1381eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal pw.format("%-15s %-12s %-9s %-32s %-12s %-23s %s\n", 1382eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal "---------", "--------", "---------", "----", "--------", "----", "------"); 1383590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan return sw.toString(); 1384590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan } 1385590f3fc2045389d5ef274c4b3bd6162d93b1a0acSamuel Tan 13860fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected abstract String directionToString(); 13870fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 13880fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected abstract String fateToString(); 13890fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 13900fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal private static String frameTypeToString(byte frameType) { 13910fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal switch (frameType) { 13920fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.FRAME_TYPE_UNKNOWN: 13930fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "unknown"; 13940fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.FRAME_TYPE_ETHERNET_II: 13950fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "data"; 13960fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.FRAME_TYPE_80211_MGMT: 13970fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "802.11 management"; 13980fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal default: 13990fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return Byte.toString(frameType); 14000fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 14010fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 1402eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal 1403eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal /** 1404eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal * Converts a driver timestamp to a wallclock time, based on the current 1405eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal * BOOTTIME to wallclock mapping. The driver timestamp is a 32-bit counter of 1406eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal * microseconds, with the same base as BOOTTIME. 1407eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal */ 1408eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal private static long convertDriverTimestampUSecToWallclockMSec(long driverTimestampUSec) { 1409eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final long wallclockMillisNow = System.currentTimeMillis(); 1410eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final long boottimeMillisNow = SystemClock.elapsedRealtime(); 1411eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final long driverTimestampMillis = driverTimestampUSec / USEC_PER_MSEC; 1412eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal 1413eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal long boottimeTimestampMillis = boottimeMillisNow % MAX_DRIVER_TIMESTAMP_MSEC; 1414eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal if (boottimeTimestampMillis < driverTimestampMillis) { 1415eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // The 32-bit microsecond count has wrapped between the time that the driver 1416eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // recorded the packet, and the call to this function. Adjust the BOOTTIME 1417eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // timestamp, to compensate. 1418eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // 1419eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // Note that overflow is not a concern here, since the result is less than 1420eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // 2 * MAX_DRIVER_TIMESTAMP_MSEC. (Given the modulus operation above, 1421eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // boottimeTimestampMillis must be less than MAX_DRIVER_TIMESTAMP_MSEC.) And, since 1422eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // MAX_DRIVER_TIMESTAMP_MSEC is an int, 2 * MAX_DRIVER_TIMESTAMP_MSEC must fit 1423eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal // within a long. 1424eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal boottimeTimestampMillis += MAX_DRIVER_TIMESTAMP_MSEC; 1425eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal } 1426eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal 1427eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal final long millisSincePacketTimestamp = boottimeTimestampMillis - driverTimestampMillis; 1428eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal return wallclockMillisNow - millisSincePacketTimestamp; 1429eaf6303a081b4a7f2231b5053099da7a1c16b7bdmukesh agrawal } 143009b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 143109b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 143209b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal /** 143309b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal * Represents the fate information for one outbound packet. 143409b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal */ 143509b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal @Immutable 143609b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal public static final class TxFateReport extends FateReport { 143709b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal TxFateReport(byte fate, long driverTimestampUSec, byte frameType, byte[] frameBytes) { 143809b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal super(fate, driverTimestampUSec, frameType, frameBytes); 143909b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 14400fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 14410fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal @Override 14420fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected String directionToString() { 14430fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "TX"; 14440fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 14450fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 14460fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal @Override 14470fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected String fateToString() { 14480fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal switch (mFate) { 14490fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_ACKED: 14500fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "acked"; 14510fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_SENT: 14520fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "sent"; 14530fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_FW_QUEUED: 14540fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware queued"; 14550fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_FW_DROP_INVALID: 14560fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (invalid frame)"; 14570fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_FW_DROP_NOBUFS: 14580fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (no bufs)"; 14590fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_FW_DROP_OTHER: 14600fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (other)"; 14610fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_DRV_QUEUED: 14620fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver queued"; 14630fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_DRV_DROP_INVALID: 14640fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (invalid frame)"; 14650fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_DRV_DROP_NOBUFS: 14660fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (no bufs)"; 14670fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.TX_PKT_FATE_DRV_DROP_OTHER: 14680fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (other)"; 14690fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal default: 14700fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return Byte.toString(mFate); 14710fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 14720fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 147309b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 147409b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 147509b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal /** 147609b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal * Represents the fate information for one inbound packet. 147709b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal */ 147809b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal @Immutable 147909b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal public static final class RxFateReport extends FateReport { 148009b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal RxFateReport(byte fate, long driverTimestampUSec, byte frameType, byte[] frameBytes) { 148109b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal super(fate, driverTimestampUSec, frameType, frameBytes); 148209b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 14830fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 14840fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal @Override 14850fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected String directionToString() { 14860fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "RX"; 14870fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 14880fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 14890fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal @Override 14900fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal protected String fateToString() { 14910fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal switch (mFate) { 14920fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_SUCCESS: 14930fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "success"; 14940fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_FW_QUEUED: 14950fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware queued"; 14960fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_FW_DROP_FILTER: 14970fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (filter)"; 14980fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_FW_DROP_INVALID: 14990fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (invalid frame)"; 15000fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_FW_DROP_NOBUFS: 15010fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (no bufs)"; 15020fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_FW_DROP_OTHER: 15030fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "firmware dropped (other)"; 15040fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_DRV_QUEUED: 15050fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver queued"; 15060fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_DRV_DROP_FILTER: 15070fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (filter)"; 15080fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_DRV_DROP_INVALID: 15090fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (invalid frame)"; 15100fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_DRV_DROP_NOBUFS: 15110fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (no bufs)"; 15120fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal case WifiLoggerHal.RX_PKT_FATE_DRV_DROP_OTHER: 15130fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return "driver dropped (other)"; 15140fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal default: 15150fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal return Byte.toString(mFate); 15160fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 15170fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 151809b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal } 151909b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 15200fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal /** 15210fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal * Ask the HAL to enable packet fate monitoring. Fails unless HAL is started. 1522b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1523b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success, false otherwise. 15240fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal */ 15250fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal public boolean startPktFateMonitoring() { 1526b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.startPktFateMonitoring(); 15270fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 15280fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 15290fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal /** 15300fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal * Fetch the most recent TX packet fates from the HAL. Fails unless HAL is started. 1531b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1532b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success, false otherwise. 15330fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal */ 15340fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal public boolean getTxPktFates(TxFateReport[] reportBufs) { 1535b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getTxPktFates(reportBufs); 15360fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 15370fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal 15380fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal /** 15390fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal * Fetch the most recent RX packet fates from the HAL. Fails unless HAL is started. 15400fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal */ 15410fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal public boolean getRxPktFates(RxFateReport[] reportBufs) { 1542b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getRxPktFates(reportBufs); 15430fcb06473cbe2824e401a80c0520bb1c14ed8f41mukesh agrawal } 154409b1d0786d05436d524d7556c269e665a0962ee6mukesh agrawal 15455c3c06082b24f9ff0d479e82a63b52220c86598bRoshan Pius /** 15469bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Set the PNO settings & the network list in HAL to start PNO. 15479bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * @param settings PNO settings and network list. 15489bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * @param eventHandler Handler to receive notifications back during PNO scan. 15499bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * @return true if success, false otherwise 15505c3c06082b24f9ff0d479e82a63b52220c86598bRoshan Pius */ 15519bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public boolean setPnoList(PnoSettings settings, PnoEventHandler eventHandler) { 1552b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "setPnoList not supported"); 1553b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 1554dd490cf1df37b70a8625dc4ec8e712f740dd1e4aPierre Vandwalle } 1555dd490cf1df37b70a8625dc4ec8e712f740dd1e4aPierre Vandwalle 15569bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius /** 15579bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * Reset the PNO settings in HAL to stop PNO. 15589bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius * @return true if success, false otherwise 15599bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius */ 15609bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bdRoshan Pius public boolean resetPnoList() { 1561b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.e(mTAG, "resetPnoList not supported"); 1562b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return false; 1563d4c25fd76644d5490700ae69fada4669de5193a1Pierre Vandwalle } 1564d4c25fd76644d5490700ae69fada4669de5193a1Pierre Vandwalle 1565b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1566b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start sending the specified keep alive packets periodically. 1567b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1568b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param slot Integer used to identify each request. 1569b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param keepAlivePacket Raw packet contents to send. 1570b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param period Period to use for sending these packets. 1571b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return 0 for success, -1 for error 1572b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1573b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int startSendingOffloadedPacket(int slot, KeepalivePacketData keepAlivePacket, 1574b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius int period) { 15753bd22cebc41ed0786d0e7bd2970a634a8bb0093ePrerepa Viswanadham String[] macAddrStr = getMacAddress().split(":"); 15763bd22cebc41ed0786d0e7bd2970a634a8bb0093ePrerepa Viswanadham byte[] srcMac = new byte[6]; 1577520fbe7db055661af039303c1081236c73b04abdRoshan Pius for (int i = 0; i < 6; i++) { 15783bd22cebc41ed0786d0e7bd2970a634a8bb0093ePrerepa Viswanadham Integer hexVal = Integer.parseInt(macAddrStr[i], 16); 15793bd22cebc41ed0786d0e7bd2970a634a8bb0093ePrerepa Viswanadham srcMac[i] = hexVal.byteValue(); 15803bd22cebc41ed0786d0e7bd2970a634a8bb0093ePrerepa Viswanadham } 1581b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.startSendingOffloadedPacket( 1582b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius slot, srcMac, keepAlivePacket, period); 1583c55e88163b223db0ca6a99ed6ffe91845c30a576Prerepa Viswanadham } 1584c55e88163b223db0ca6a99ed6ffe91845c30a576Prerepa Viswanadham 1585b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1586b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Stop sending the specified keep alive packets. 1587b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1588b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param slot id - same as startSendingOffloadedPacket call. 1589b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return 0 for success, -1 for error 1590b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1591b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public int stopSendingOffloadedPacket(int slot) { 1592b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.stopSendingOffloadedPacket(slot); 1593c55e88163b223db0ca6a99ed6ffe91845c30a576Prerepa Viswanadham } 1594aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham 1595aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham public static interface WifiRssiEventHandler { 1596aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham void onRssiThresholdBreached(byte curRssi); 1597aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham } 1598aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham 1599b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1600b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Start RSSI monitoring on the currently connected access point. 1601b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1602b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param maxRssi Maximum RSSI threshold. 1603b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param minRssi Minimum RSSI threshold. 1604b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param rssiEventHandler Called when RSSI goes above maxRssi or below minRssi 1605b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return 0 for success, -1 for failure 1606b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 160718786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public int startRssiMonitoring(byte maxRssi, byte minRssi, 1608b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius WifiRssiEventHandler rssiEventHandler) { 1609b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.startRssiMonitoring(maxRssi, minRssi, rssiEventHandler); 1610aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham } 1611aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham 161218786eca942042388748b0d98979f21c9dff4a89Mitchell Wills public int stopRssiMonitoring() { 1613b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.stopRssiMonitoring(); 1614aed5cb65d8eefb2eee56a29e33ac3cd8b03312e7Prerepa Viswanadham } 16155ea42964ba17901a8d724736b450ace6ed48880fPrerepa Viswanadham 16166bf6986d359556010638dfae332b585162f06520Roshan Pius /** 16176bf6986d359556010638dfae332b585162f06520Roshan Pius * Fetch the host wakeup reasons stats from wlan driver. 1618b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 16196bf6986d359556010638dfae332b585162f06520Roshan Pius * @return the |WifiWakeReasonAndCounts| object retrieved from the wlan driver. 16206bf6986d359556010638dfae332b585162f06520Roshan Pius */ 16216bf6986d359556010638dfae332b585162f06520Roshan Pius public WifiWakeReasonAndCounts getWlanWakeReasonCount() { 1622b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getWlanWakeReasonCount(); 16236bf6986d359556010638dfae332b585162f06520Roshan Pius } 16243dd6f75ff2ab823bd0c14581f2e047c74916f16fErik Kline 1625b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1626b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Enable/Disable Neighbour discovery offload functionality in the firmware. 1627b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1628b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @param enabled true to enable, false to disable. 1629b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success, false otherwise. 1630b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 16313dd6f75ff2ab823bd0c14581f2e047c74916f16fErik Kline public boolean configureNeighborDiscoveryOffload(boolean enabled) { 1632b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.configureNeighborDiscoveryOffload(enabled); 16333dd6f75ff2ab823bd0c14581f2e047c74916f16fErik Kline } 1634da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1635da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan // Firmware roaming control. 1636da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1637da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1638da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Class to retrieve firmware roaming capability parameters. 1639da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1640da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public static class RoamingCapabilities { 1641da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public int maxBlacklistSize; 1642da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public int maxWhitelistSize; 1643da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1644da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1645da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1646da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Query the firmware roaming capabilities. 1647b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return true for success, false otherwise. 1648da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1649da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public boolean getRoamingCapabilities(RoamingCapabilities capabilities) { 1650b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.getRoamingCapabilities(capabilities); 1651da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1652da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1653da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1654da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Macros for controlling firmware roaming. 1655da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1656da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public static final int DISABLE_FIRMWARE_ROAMING = 0; 1657da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public static final int ENABLE_FIRMWARE_ROAMING = 1; 1658da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1659da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1660da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Enable/disable firmware roaming. 1661b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * 1662b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * @return error code returned from HAL. 1663da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1664da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public int enableFirmwareRoaming(int state) { 1665b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.enableFirmwareRoaming(state); 1666da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1667da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1668da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1669da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Class for specifying the roaming configurations. 1670da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1671da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public static class RoamingConfig { 1672da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public ArrayList<String> blacklistBssids; 1673da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public ArrayList<String> whitelistSsids; 1674da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1675da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1676da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan /** 1677da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan * Set firmware roaming configurations. 1678da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan */ 1679da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan public boolean configureRoaming(RoamingConfig config) { 1680b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius Log.d(mTAG, "configureRoaming "); 1681b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.configureRoaming(config); 1682da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1683da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan 1684374f78d3841f7bf74543dc4d21db66d1d3472c3aRandy Pan /** 1685374f78d3841f7bf74543dc4d21db66d1d3472c3aRandy Pan * Reset firmware roaming configuration. 1686374f78d3841f7bf74543dc4d21db66d1d3472c3aRandy Pan */ 1687374f78d3841f7bf74543dc4d21db66d1d3472c3aRandy Pan public boolean resetRoamingConfiguration() { 1688b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // Pass in an empty RoamingConfig object which translates to zero size 1689b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius // blacklist and whitelist to reset the firmware roaming configuration. 1690b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return mWifiVendorHal.configureRoaming(new RoamingConfig()); 1691b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } 1692b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 1693b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /******************************************************** 1694b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * JNI operations 1695b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius ********************************************************/ 1696b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /* Register native functions */ 1697b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius static { 1698b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /* Native functions are defined in libwifi-service.so */ 1699b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius System.loadLibrary("wifi-service"); 1700b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius registerNatives(); 1701b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } 1702b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 1703b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius private static native int registerNatives(); 1704b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /* kernel logging support */ 1705b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius private static native byte[] readKernelLogNative(); 1706b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius 1707b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius /** 1708b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius * Fetches the latest kernel logs. 1709b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius */ 1710b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius public synchronized String readKernelLog() { 1711b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius byte[] bytes = readKernelLogNative(); 1712b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius if (bytes != null) { 1713b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder(); 1714b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius try { 1715b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius CharBuffer decoded = decoder.decode(ByteBuffer.wrap(bytes)); 1716b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return decoded.toString(); 1717b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } catch (CharacterCodingException cce) { 1718b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return new String(bytes, StandardCharsets.ISO_8859_1); 1719b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius } 1720520fbe7db055661af039303c1081236c73b04abdRoshan Pius } else { 1721b8b3fb8228a1f90106bad8c59ce006b81ef7921cRoshan Pius return "*** failed to read kernel log ***"; 1722374f78d3841f7bf74543dc4d21db66d1d3472c3aRandy Pan } 1723da4958bd7409aaf26ead2b221754d4a5035f7bdfRandy Pan } 1724155b9d09ef9b8ead3ca617afdd91e74070d3f0cbVinit Deshpande} 1725