Loading services/java/com/android/server/wifi/WifiService.java +6 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,12 @@ public final class WifiService extends IWifiManager.Stub { return mBatchedScanSupported; } public void pollBatchedScan() { enforceChangePermission(); if (mBatchedScanSupported == false) return; mWifiStateMachine.requestBatchedScanPoll(); } /** * see {@link android.net.wifi.WifiManager#requestBatchedScan()} */ Loading wifi/java/android/net/wifi/BatchedScanSettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class BatchedScanSettings implements Parcelable { public final static int MAX_AP_FOR_DISTANCE = MAX_AP_PER_SCAN; public final static int DEFAULT_AP_FOR_DISTANCE = 0; public final static int MAX_WIFI_CHANNEL = 196; /** The expected number of scans per batch. Note that the firmware may drop scans * leading to fewer scans during the normal batch scan duration. This value need not Loading Loading @@ -113,7 +114,7 @@ public class BatchedScanSettings implements Parcelable { for (String channel : channelSet) { try { int i = Integer.parseInt(channel); if (i > 0 && i < 197) continue; if (i > 0 && i <= MAX_WIFI_CHANNEL) continue; } catch (NumberFormatException e) {} if (channel.equals("A") || channel.equals("B")) continue; return false; Loading wifi/java/android/net/wifi/IWifiManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -124,5 +124,7 @@ interface IWifiManager List<BatchedScanResult> getBatchedScanResults(String callingPackage); boolean isBatchedScanSupported(); void pollBatchedScan(); } wifi/java/android/net/wifi/WifiManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -839,6 +839,32 @@ public class WifiManager { } } /** * Force a re-reading of batched scan results. This will attempt * to read more information from the chip, but will do so at the expense * of previous data. Rate limited to the current scan frequency. * * pollBatchedScan will always wait 1 period from the start of the batch * before trying to read from the chip, so if your #scans/batch == 1 this will * have no effect. * * If you had already waited 1 period before calling, this should have * immediate (though async) effect. * * If you call before that 1 period is up this will set up a timer and fetch * results when the 1 period is up. * * Servicing a pollBatchedScan request (immediate or after timed delay) starts a * new batch, so if you were doing 10 scans/batch and called in the 4th scan, you * would get data in the 4th and then again 10 scans later. * @hide */ public void pollBatchedScan() { try { mService.pollBatchedScan(); } catch (RemoteException e) { } } /** * Return dynamic information about the current Wi-Fi connection, if any is active. * @return the Wi-Fi information, contained in {@link WifiInfo}. Loading wifi/java/android/net/wifi/WifiNative.java +4 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,9 @@ public class WifiNative { /** * Format of command * DRIVER WLS_BATCHING SET SCAN_FRQ=x BESTN=y CHANNEL=<z, w, t> RTT=s * DRIVER WLS_BATCHING SET SCAN_FRQ=x MSCAN=r BESTN=y CHANNEL=<z, w, t> RTT=s * where x is an ascii representation of an integer number of seconds between scans * r is an ascii representation of an integer number of scans per batch * y is an ascii representation of an integer number of the max AP to remember per scan * z, w, t represent a 1..n size list of channel numbers and/or 'A', 'B' values * indicating entire ranges of channels Loading @@ -235,8 +236,9 @@ public class WifiNative { public String setBatchedScanSettings(BatchedScanSettings settings) { if (settings == null) return doStringCommand("DRIVER WLS_BATCHING STOP"); String cmd = "DRIVER WLS_BATCHING SET SCAN_FRQ=" + settings.scanIntervalSec; cmd += " MSCAN=" + settings.maxScansPerBatch; if (settings.maxApPerScan != BatchedScanSettings.UNSPECIFIED) { cmd += " BESTN " + settings.maxApPerScan; cmd += " BESTN=" + settings.maxApPerScan; } if (settings.channelSet != null && !settings.channelSet.isEmpty()) { cmd += " CHANNEL=<"; Loading Loading
services/java/com/android/server/wifi/WifiService.java +6 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,12 @@ public final class WifiService extends IWifiManager.Stub { return mBatchedScanSupported; } public void pollBatchedScan() { enforceChangePermission(); if (mBatchedScanSupported == false) return; mWifiStateMachine.requestBatchedScanPoll(); } /** * see {@link android.net.wifi.WifiManager#requestBatchedScan()} */ Loading
wifi/java/android/net/wifi/BatchedScanSettings.java +2 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ public class BatchedScanSettings implements Parcelable { public final static int MAX_AP_FOR_DISTANCE = MAX_AP_PER_SCAN; public final static int DEFAULT_AP_FOR_DISTANCE = 0; public final static int MAX_WIFI_CHANNEL = 196; /** The expected number of scans per batch. Note that the firmware may drop scans * leading to fewer scans during the normal batch scan duration. This value need not Loading Loading @@ -113,7 +114,7 @@ public class BatchedScanSettings implements Parcelable { for (String channel : channelSet) { try { int i = Integer.parseInt(channel); if (i > 0 && i < 197) continue; if (i > 0 && i <= MAX_WIFI_CHANNEL) continue; } catch (NumberFormatException e) {} if (channel.equals("A") || channel.equals("B")) continue; return false; Loading
wifi/java/android/net/wifi/IWifiManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -124,5 +124,7 @@ interface IWifiManager List<BatchedScanResult> getBatchedScanResults(String callingPackage); boolean isBatchedScanSupported(); void pollBatchedScan(); }
wifi/java/android/net/wifi/WifiManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -839,6 +839,32 @@ public class WifiManager { } } /** * Force a re-reading of batched scan results. This will attempt * to read more information from the chip, but will do so at the expense * of previous data. Rate limited to the current scan frequency. * * pollBatchedScan will always wait 1 period from the start of the batch * before trying to read from the chip, so if your #scans/batch == 1 this will * have no effect. * * If you had already waited 1 period before calling, this should have * immediate (though async) effect. * * If you call before that 1 period is up this will set up a timer and fetch * results when the 1 period is up. * * Servicing a pollBatchedScan request (immediate or after timed delay) starts a * new batch, so if you were doing 10 scans/batch and called in the 4th scan, you * would get data in the 4th and then again 10 scans later. * @hide */ public void pollBatchedScan() { try { mService.pollBatchedScan(); } catch (RemoteException e) { } } /** * Return dynamic information about the current Wi-Fi connection, if any is active. * @return the Wi-Fi information, contained in {@link WifiInfo}. Loading
wifi/java/android/net/wifi/WifiNative.java +4 −2 Original line number Diff line number Diff line Loading @@ -221,8 +221,9 @@ public class WifiNative { /** * Format of command * DRIVER WLS_BATCHING SET SCAN_FRQ=x BESTN=y CHANNEL=<z, w, t> RTT=s * DRIVER WLS_BATCHING SET SCAN_FRQ=x MSCAN=r BESTN=y CHANNEL=<z, w, t> RTT=s * where x is an ascii representation of an integer number of seconds between scans * r is an ascii representation of an integer number of scans per batch * y is an ascii representation of an integer number of the max AP to remember per scan * z, w, t represent a 1..n size list of channel numbers and/or 'A', 'B' values * indicating entire ranges of channels Loading @@ -235,8 +236,9 @@ public class WifiNative { public String setBatchedScanSettings(BatchedScanSettings settings) { if (settings == null) return doStringCommand("DRIVER WLS_BATCHING STOP"); String cmd = "DRIVER WLS_BATCHING SET SCAN_FRQ=" + settings.scanIntervalSec; cmd += " MSCAN=" + settings.maxScansPerBatch; if (settings.maxApPerScan != BatchedScanSettings.UNSPECIFIED) { cmd += " BESTN " + settings.maxApPerScan; cmd += " BESTN=" + settings.maxApPerScan; } if (settings.channelSet != null && !settings.channelSet.isEmpty()) { cmd += " CHANNEL=<"; Loading