BatchedScanSettings.java revision 0451d59ba2d768e7653752028910f00a6c96e64e
10451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt/* 20451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Copyright (C) 2008 The Android Open Source Project 30451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * 40451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Licensed under the Apache License, Version 2.0 (the "License"); 50451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * you may not use this file except in compliance with the License. 60451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * You may obtain a copy of the License at 70451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * 80451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * http://www.apache.org/licenses/LICENSE-2.0 90451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * 100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Unless required by applicable law or agreed to in writing, software 110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * distributed under the License is distributed on an "AS IS" BASIS, 120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * See the License for the specific language governing permissions and 140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * limitations under the License. 150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 170451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltpackage android.net.wifi; 180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport android.os.Parcelable; 200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport android.os.Parcel; 210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport java.util.ArrayList; 230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltimport java.util.Collection; 240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt/** 260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * Describes the settings for batched wifi scans where the firmware performs many 270451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * scans and stores the timestamped results without waking the main processor each time. 280451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * This can give information over time with minimal battery impact. 290451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * @hide pending review 300451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 310451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwaltpublic class BatchedScanSettings implements Parcelable { 320451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt private static final String TAG = "BatchedScanSettings"; 330451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 340451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** Used to indicate no preference for an int value */ 350451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int UNSPECIFIED = Integer.MAX_VALUE; 360451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 370451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt // TODO - make MIN/mAX dynamic and gservices adjustable. 380451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MIN_SCANS_PER_BATCH = 2; 390451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MAX_SCANS_PER_BATCH = 255; 400451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int DEFAULT_SCANS_PER_BATCH = MAX_SCANS_PER_BATCH; 410451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 420451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MIN_AP_PER_SCAN = 2; 430451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MAX_AP_PER_SCAN = 255; 440451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int DEFAULT_AP_PER_SCAN = 16; 450451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 460451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MIN_INTERVAL_SEC = 0; 470451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MAX_INTERVAL_SEC = 3600; 480451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int DEFAULT_INTERVAL_SEC = 30; 490451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 500451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MIN_AP_FOR_DISTANCE = 0; 510451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int MAX_AP_FOR_DISTANCE = MAX_AP_PER_SCAN; 520451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public final static int DEFAULT_AP_FOR_DISTANCE = 0; 530451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 540451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 550451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** The expected number of scans per batch. Note that the firmware may drop scans 560451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * leading to fewer scans during the normal batch scan duration. This value need not 570451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * be specified (may be set to {@link UNSPECIFIED}) by the application and we will try 580451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * to scan as many times as the firmware can support. If another app requests fewer 590451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * scans per batch we will attempt to honor that. 600451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 610451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int maxScansPerBatch; 620451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 630451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** The maximum desired AP listed per scan. Fewer AP may be returned if that's all 640451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * that the driver detected. If another application requests more AP per scan that 650451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * will take precedence. The if more channels are detected than we request, the APs 660451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * with the lowest signal strength will be dropped. 670451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 680451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int maxApPerScan; 690451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 700451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** The channels used in the scan. If all channels should be used, {@code null} may be 710451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * specified. If another application requests more channels or all channels, that 720451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * will take precedence. 730451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 740451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public Collection<String> channelSet; 750451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 760451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** The time between the start of two sequential scans, in seconds. If another 770451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * application requests more frequent scans, that will take precedence. If this 780451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * value is less than the duration of a scan, the next scan should start immediately. 790451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 800451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int scanIntervalSec; 810451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 820451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** The number of the best (strongest signal) APs for which the firmware will 830451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * attempt to get distance information (RTT). Not all firmware supports this 840451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * feature, so it may be ignored. If another application requests a greater 850451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt * number, that will take precedence. 860451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt */ 870451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int maxApForDistance; 880451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 890451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public BatchedScanSettings() { 900451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt clear(); 910451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 920451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 930451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public void clear() { 940451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxScansPerBatch = UNSPECIFIED; 950451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApPerScan = UNSPECIFIED; 960451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt channelSet = null; 970451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt scanIntervalSec = UNSPECIFIED; 980451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApForDistance = UNSPECIFIED; 990451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1000451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1010451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public BatchedScanSettings(BatchedScanSettings source) { 1020451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxScansPerBatch = source.maxScansPerBatch; 1030451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApPerScan = source.maxApPerScan; 1040451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (source.channelSet != null) { 1050451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt channelSet = new ArrayList(source.channelSet); 1060451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1070451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt scanIntervalSec = source.scanIntervalSec; 1080451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApForDistance = source.maxApForDistance; 1090451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt private boolean channelSetIsValid() { 1120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelSet == null || channelSet.isEmpty()) return true; 1130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt for (String channel : channelSet) { 1140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt try { 1150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt int i = Integer.parseInt(channel); 1160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (i > 0 && i < 197) continue; 1170451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } catch (NumberFormatException e) {} 1180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channel.equals("A") || channel.equals("B")) continue; 1190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return false; 1200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return true; 1220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** @hide */ 1240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public boolean isInvalid() { 1250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (maxScansPerBatch != UNSPECIFIED && (maxScansPerBatch < MIN_SCANS_PER_BATCH || 1260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxScansPerBatch > MAX_SCANS_PER_BATCH)) return true; 1270451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (maxApPerScan != UNSPECIFIED && (maxApPerScan < MIN_AP_PER_SCAN || 1280451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApPerScan > MAX_AP_PER_SCAN)) return true; 1290451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelSetIsValid() == false) return true; 1300451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (scanIntervalSec != UNSPECIFIED && (scanIntervalSec < MIN_INTERVAL_SEC || 1310451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt scanIntervalSec > MAX_INTERVAL_SEC)) return true; 1320451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (maxApForDistance != UNSPECIFIED && (maxApForDistance < MIN_AP_FOR_DISTANCE || 1330451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApForDistance > MAX_AP_FOR_DISTANCE)) return true; 1340451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return false; 1350451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1360451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1370451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt @Override 1380451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public boolean equals(Object obj) { 1390451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (obj instanceof BatchedScanSettings == false) return false; 1400451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt BatchedScanSettings o = (BatchedScanSettings)obj; 1410451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (maxScansPerBatch != o.maxScansPerBatch || 1420451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApPerScan != o.maxApPerScan || 1430451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt scanIntervalSec != o.scanIntervalSec || 1440451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt maxApForDistance != o.maxApForDistance) return false; 1450451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelSet == null) { 1460451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return (o.channelSet == null); 1470451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1480451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return channelSet.equals(o.channelSet); 1490451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1500451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1510451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt @Override 1520451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int hashCode() { 1530451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return maxScansPerBatch + 1540451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt (maxApPerScan * 3) + 1550451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt (scanIntervalSec * 5) + 1560451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt (maxApForDistance * 7) + 1570451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt (channelSet.hashCode() * 11); 1580451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1590451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1600451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt @Override 1610451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public String toString() { 1620451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt StringBuffer sb = new StringBuffer(); 1630451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt String none = "<none>"; 1640451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1650451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append("BatchScanSettings [maxScansPerBatch: "). 1660451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(maxScansPerBatch == UNSPECIFIED ? none : maxScansPerBatch). 1670451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(", maxApPerScan: ").append(maxApPerScan == UNSPECIFIED? none : maxApPerScan). 1680451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(", scanIntervalSec: "). 1690451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(scanIntervalSec == UNSPECIFIED ? none : scanIntervalSec). 1700451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(", maxApForDistance: "). 1710451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(maxApForDistance == UNSPECIFIED ? none : maxApForDistance). 1720451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt append(", channelSet: "); 1730451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelSet == null) { 1740451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append("ALL"); 1750451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } else { 1760451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append("<"); 1770451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt for (String channel : channelSet) { 1780451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append(" " + channel); 1790451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1800451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append(">"); 1810451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1820451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt sb.append("]"); 1830451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return sb.toString(); 1840451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1850451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1860451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** Implement the Parcelable interface {@hide} */ 1870451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public int describeContents() { 1880451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return 0; 1890451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 1900451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 1910451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** Implement the Parcelable interface {@hide} */ 1920451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public void writeToParcel(Parcel dest, int flags) { 1930451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt dest.writeInt(maxScansPerBatch); 1940451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt dest.writeInt(maxApPerScan); 1950451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt dest.writeInt(scanIntervalSec); 1960451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt dest.writeInt(maxApForDistance); 1970451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt dest.writeInt(channelSet == null ? 0 : channelSet.size()); 1980451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelSet != null) { 1990451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt for (String channel : channelSet) dest.writeString(channel); 2000451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2010451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2020451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 2030451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt /** Implement the Parcelable interface {@hide} */ 2040451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public static final Creator<BatchedScanSettings> CREATOR = 2050451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt new Creator<BatchedScanSettings>() { 2060451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public BatchedScanSettings createFromParcel(Parcel in) { 2070451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt BatchedScanSettings settings = new BatchedScanSettings(); 2080451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.maxScansPerBatch = in.readInt(); 2090451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.maxApPerScan = in.readInt(); 2100451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.scanIntervalSec = in.readInt(); 2110451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.maxApForDistance = in.readInt(); 2120451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt int channelCount = in.readInt(); 2130451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt if (channelCount > 0) { 2140451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.channelSet = new ArrayList(channelCount); 2150451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt while (channelCount-- > 0) { 2160451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt settings.channelSet.add(in.readString()); 2170451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2180451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2190451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return settings; 2200451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2210451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt 2220451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt public BatchedScanSettings[] newArray(int size) { 2230451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt return new BatchedScanSettings[size]; 2240451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt } 2250451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt }; 2260451d59ba2d768e7653752028910f00a6c96e64eRobert Greenwalt} 227