diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2013-09-20 15:13:08 -0700 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2013-09-20 15:30:17 -0700 |
commit | 13820af302ead6b6a17b5f1b3991fcf8af252f93 (patch) | |
tree | 77139f764e8cc8a878cf0b8f90ff02c577519013 /wifi/java/android/net | |
parent | c237c20441df671a4c596138976f15e40aa95cf3 (diff) | |
download | frameworks_base-13820af302ead6b6a17b5f1b3991fcf8af252f93.zip frameworks_base-13820af302ead6b6a17b5f1b3991fcf8af252f93.tar.gz frameworks_base-13820af302ead6b6a17b5f1b3991fcf8af252f93.tar.bz2 |
Fix BatchScan request coalesing
bug:10407896
Change-Id: Ic22c7d8b2a80d490d208570782a12e42d4690f5c
Diffstat (limited to 'wifi/java/android/net')
-rw-r--r-- | wifi/java/android/net/wifi/BatchedScanSettings.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/BatchedScanSettings.java b/wifi/java/android/net/wifi/BatchedScanSettings.java index 44a2ab4..f7ebc17 100644 --- a/wifi/java/android/net/wifi/BatchedScanSettings.java +++ b/wifi/java/android/net/wifi/BatchedScanSettings.java @@ -135,6 +135,42 @@ public class BatchedScanSettings implements Parcelable { return false; } + /** @hide */ + public void constrain() { + if (scanIntervalSec == UNSPECIFIED) { + scanIntervalSec = DEFAULT_INTERVAL_SEC; + } else if (scanIntervalSec < MIN_INTERVAL_SEC) { + scanIntervalSec = MIN_INTERVAL_SEC; + } else if (scanIntervalSec > MAX_INTERVAL_SEC) { + scanIntervalSec = MAX_INTERVAL_SEC; + } + + if (maxScansPerBatch == UNSPECIFIED) { + maxScansPerBatch = DEFAULT_SCANS_PER_BATCH; + } else if (maxScansPerBatch < MIN_SCANS_PER_BATCH) { + maxScansPerBatch = MIN_SCANS_PER_BATCH; + } else if (maxScansPerBatch > MAX_SCANS_PER_BATCH) { + maxScansPerBatch = MAX_SCANS_PER_BATCH; + } + + if (maxApPerScan == UNSPECIFIED) { + maxApPerScan = DEFAULT_AP_PER_SCAN; + } else if (maxApPerScan < MIN_AP_PER_SCAN) { + maxApPerScan = MIN_AP_PER_SCAN; + } else if (maxApPerScan > MAX_AP_PER_SCAN) { + maxApPerScan = MAX_AP_PER_SCAN; + } + + if (maxApForDistance == UNSPECIFIED) { + maxApForDistance = DEFAULT_AP_FOR_DISTANCE; + } else if (maxApForDistance < MIN_AP_FOR_DISTANCE) { + maxApForDistance = MIN_AP_FOR_DISTANCE; + } else if (maxApForDistance > MAX_AP_FOR_DISTANCE) { + maxApForDistance = MAX_AP_FOR_DISTANCE; + } + } + + @Override public boolean equals(Object obj) { if (obj instanceof BatchedScanSettings == false) return false; |