The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.net.wifi; |
| 18 | |
Amin Shaikh | f9d47b7 | 2016-12-09 17:11:50 -0800 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 20 | import android.annotation.UnsupportedAppUsage; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | import android.os.Parcel; |
Jeff Davidson | e4ce619 | 2014-08-08 16:48:13 -0700 | [diff] [blame] | 22 | import android.os.Parcelable; |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 23 | |
| 24 | import java.util.ArrayList; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 25 | import java.util.Arrays; |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 26 | import java.util.List; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 27 | import java.util.Objects; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Describes information about a detected access point. In addition |
| 31 | * to the attributes described here, the supplicant keeps track of |
| 32 | * {@code quality}, {@code noise}, and {@code maxbitrate} attributes, |
| 33 | * but does not currently report them to external clients. |
| 34 | */ |
| 35 | public class ScanResult implements Parcelable { |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 36 | /** |
| 37 | * The network name. |
| 38 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 39 | public String SSID; |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 40 | |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Ascii encoded SSID. This will replace SSID when we deprecate it. @hide |
| 43 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 44 | @UnsupportedAppUsage |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 45 | public WifiSsid wifiSsid; |
| 46 | |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 47 | /** |
| 48 | * The address of the access point. |
| 49 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | public String BSSID; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * The HESSID from the beacon. |
| 54 | * @hide |
| 55 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 56 | @UnsupportedAppUsage |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 57 | public long hessid; |
| 58 | |
| 59 | /** |
| 60 | * The ANQP Domain ID from the Hotspot 2.0 Indication element, if present. |
| 61 | * @hide |
| 62 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 63 | @UnsupportedAppUsage |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 64 | public int anqpDomainId; |
| 65 | |
Samuel Tan | 40b5617 | 2016-03-23 14:21:28 -0700 | [diff] [blame] | 66 | /* |
| 67 | * This field is equivalent to the |flags|, rather than the |capabilities| field |
| 68 | * of the per-BSS scan results returned by WPA supplicant. See the definition of |
| 69 | * |struct wpa_bss| in wpa_supplicant/bss.h for more details. |
| 70 | */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 71 | /** |
| 72 | * Describes the authentication, key management, and encryption schemes |
| 73 | * supported by the access point. |
| 74 | */ |
| 75 | public String capabilities; |
Ningyuan Wang | d150b2b | 2016-11-01 15:36:10 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * @hide |
| 79 | * No security protocol. |
| 80 | */ |
| 81 | public static final int PROTOCOL_NONE = 0; |
| 82 | /** |
| 83 | * @hide |
| 84 | * Security protocol type: WPA version 1. |
| 85 | */ |
| 86 | public static final int PROTOCOL_WPA = 1; |
| 87 | /** |
| 88 | * @hide |
Hai Shalom | 6adbc58 | 2018-10-16 14:30:14 -0700 | [diff] [blame] | 89 | * Security protocol type: RSN, for WPA version 2, and version 3. |
Ningyuan Wang | d150b2b | 2016-11-01 15:36:10 -0700 | [diff] [blame] | 90 | */ |
Hai Shalom | 6adbc58 | 2018-10-16 14:30:14 -0700 | [diff] [blame] | 91 | public static final int PROTOCOL_RSN = 2; |
Ningyuan Wang | d150b2b | 2016-11-01 15:36:10 -0700 | [diff] [blame] | 92 | /** |
| 93 | * @hide |
| 94 | * Security protocol type: |
| 95 | * OSU Server-only authenticated layer 2 Encryption Network. |
| 96 | * Used for Hotspot 2.0. |
| 97 | */ |
| 98 | public static final int PROTOCOL_OSEN = 3; |
| 99 | |
| 100 | /** |
| 101 | * @hide |
| 102 | * No security key management scheme. |
| 103 | */ |
| 104 | public static final int KEY_MGMT_NONE = 0; |
| 105 | /** |
| 106 | * @hide |
| 107 | * Security key management scheme: PSK. |
| 108 | */ |
| 109 | public static final int KEY_MGMT_PSK = 1; |
| 110 | /** |
| 111 | * @hide |
| 112 | * Security key management scheme: EAP. |
| 113 | */ |
| 114 | public static final int KEY_MGMT_EAP = 2; |
| 115 | /** |
| 116 | * @hide |
| 117 | * Security key management scheme: FT_PSK. |
| 118 | */ |
| 119 | public static final int KEY_MGMT_FT_PSK = 3; |
| 120 | /** |
| 121 | * @hide |
| 122 | * Security key management scheme: FT_EAP. |
| 123 | */ |
| 124 | public static final int KEY_MGMT_FT_EAP = 4; |
| 125 | /** |
| 126 | * @hide |
| 127 | * Security key management scheme: PSK_SHA256 |
| 128 | */ |
| 129 | public static final int KEY_MGMT_PSK_SHA256 = 5; |
| 130 | /** |
| 131 | * @hide |
| 132 | * Security key management scheme: EAP_SHA256. |
| 133 | */ |
| 134 | public static final int KEY_MGMT_EAP_SHA256 = 6; |
| 135 | /** |
| 136 | * @hide |
| 137 | * Security key management scheme: OSEN. |
| 138 | * Used for Hotspot 2.0. |
| 139 | */ |
| 140 | public static final int KEY_MGMT_OSEN = 7; |
Hai Shalom | 6adbc58 | 2018-10-16 14:30:14 -0700 | [diff] [blame] | 141 | /** |
| 142 | * @hide |
| 143 | * Security key management scheme: SAE. |
| 144 | */ |
| 145 | public static final int KEY_MGMT_SAE = 8; |
| 146 | /** |
| 147 | * @hide |
| 148 | * Security key management scheme: OWE. |
| 149 | */ |
| 150 | public static final int KEY_MGMT_OWE = 9; |
| 151 | /** |
| 152 | * @hide |
| 153 | * Security key management scheme: SUITE_B_192. |
| 154 | */ |
| 155 | public static final int KEY_MGMT_EAP_SUITE_B_192 = 10; |
Ningyuan Wang | d150b2b | 2016-11-01 15:36:10 -0700 | [diff] [blame] | 156 | /** |
| 157 | * @hide |
| 158 | * No cipher suite. |
| 159 | */ |
| 160 | public static final int CIPHER_NONE = 0; |
| 161 | /** |
| 162 | * @hide |
| 163 | * No group addressed, only used for group data cipher. |
| 164 | */ |
| 165 | public static final int CIPHER_NO_GROUP_ADDRESSED = 1; |
| 166 | /** |
| 167 | * @hide |
| 168 | * Cipher suite: TKIP |
| 169 | */ |
| 170 | public static final int CIPHER_TKIP = 2; |
| 171 | /** |
| 172 | * @hide |
| 173 | * Cipher suite: CCMP |
| 174 | */ |
| 175 | public static final int CIPHER_CCMP = 3; |
Hai Shalom | 6adbc58 | 2018-10-16 14:30:14 -0700 | [diff] [blame] | 176 | /** |
| 177 | * @hide |
| 178 | * Cipher suite: GCMP |
| 179 | */ |
| 180 | public static final int CIPHER_GCMP_256 = 4; |
Ningyuan Wang | d150b2b | 2016-11-01 15:36:10 -0700 | [diff] [blame] | 181 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 182 | /** |
Jeff Davidson | e4ce619 | 2014-08-08 16:48:13 -0700 | [diff] [blame] | 183 | * The detected signal level in dBm, also known as the RSSI. |
| 184 | * |
| 185 | * <p>Use {@link android.net.wifi.WifiManager#calculateSignalLevel} to convert this number into |
| 186 | * an absolute signal level which can be displayed to a user. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | */ |
| 188 | public int level; |
| 189 | /** |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 190 | * The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 191 | * with the access point. |
| 192 | */ |
| 193 | public int frequency; |
| 194 | |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 195 | /** |
| 196 | * AP Channel bandwidth is 20 MHZ |
| 197 | */ |
| 198 | public static final int CHANNEL_WIDTH_20MHZ = 0; |
| 199 | /** |
| 200 | * AP Channel bandwidth is 40 MHZ |
| 201 | */ |
| 202 | public static final int CHANNEL_WIDTH_40MHZ = 1; |
| 203 | /** |
| 204 | * AP Channel bandwidth is 80 MHZ |
| 205 | */ |
| 206 | public static final int CHANNEL_WIDTH_80MHZ = 2; |
| 207 | /** |
| 208 | * AP Channel bandwidth is 160 MHZ |
| 209 | */ |
| 210 | public static final int CHANNEL_WIDTH_160MHZ = 3; |
| 211 | /** |
| 212 | * AP Channel bandwidth is 160 MHZ, but 80MHZ + 80MHZ |
| 213 | */ |
| 214 | public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; |
| 215 | |
| 216 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 217 | * AP Channel bandwidth; one of {@link #CHANNEL_WIDTH_20MHZ}, {@link #CHANNEL_WIDTH_40MHZ}, |
| 218 | * {@link #CHANNEL_WIDTH_80MHZ}, {@link #CHANNEL_WIDTH_160MHZ} |
| 219 | * or {@link #CHANNEL_WIDTH_80MHZ_PLUS_MHZ}. |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 220 | */ |
| 221 | public int channelWidth; |
| 222 | |
| 223 | /** |
| 224 | * Not used if the AP bandwidth is 20 MHz |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 225 | * If the AP use 40, 80 or 160 MHz, this is the center frequency (in MHz) |
| 226 | * if the AP use 80 + 80 MHz, this is the center frequency of the first segment (in MHz) |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 227 | */ |
| 228 | public int centerFreq0; |
| 229 | |
| 230 | /** |
| 231 | * Only used if the AP bandwidth is 80 + 80 MHz |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 232 | * if the AP use 80 + 80 MHz, this is the center frequency of the second segment (in MHz) |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 233 | */ |
| 234 | public int centerFreq1; |
| 235 | |
| 236 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 237 | * @deprecated use is80211mcResponder() instead |
| 238 | * @hide |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 239 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 240 | @UnsupportedAppUsage |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 241 | public boolean is80211McRTTResponder; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 242 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 243 | /** |
Vinit Deshpande | 02b115b | 2014-09-19 14:23:25 -0700 | [diff] [blame] | 244 | * timestamp in microseconds (since boot) when |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 245 | * this result was last seen. |
| 246 | */ |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 247 | public long timestamp; |
| 248 | |
| 249 | /** |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 250 | * Timestamp representing date when this result was last seen, in milliseconds from 1970 |
| 251 | * {@hide} |
| 252 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 253 | @UnsupportedAppUsage |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 254 | public long seen; |
| 255 | |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 256 | /** |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 257 | * On devices with multiple hardware radio chains, this class provides metadata about |
| 258 | * each radio chain that was used to receive this scan result (probe response or beacon). |
| 259 | * {@hide} |
| 260 | */ |
| 261 | public static class RadioChainInfo { |
| 262 | /** Vendor defined id for a radio chain. */ |
| 263 | public int id; |
| 264 | /** Detected signal level in dBm (also known as the RSSI) on this radio chain. */ |
| 265 | public int level; |
| 266 | |
| 267 | @Override |
| 268 | public String toString() { |
| 269 | return "RadioChainInfo: id=" + id + ", level=" + level; |
| 270 | } |
| 271 | |
| 272 | @Override |
| 273 | public boolean equals(Object otherObj) { |
| 274 | if (this == otherObj) { |
| 275 | return true; |
| 276 | } |
| 277 | if (!(otherObj instanceof RadioChainInfo)) { |
| 278 | return false; |
| 279 | } |
| 280 | RadioChainInfo other = (RadioChainInfo) otherObj; |
| 281 | return id == other.id && level == other.level; |
| 282 | } |
| 283 | |
| 284 | @Override |
| 285 | public int hashCode() { |
| 286 | return Objects.hash(id, level); |
| 287 | } |
| 288 | }; |
| 289 | |
| 290 | /** |
| 291 | * Information about the list of the radio chains used to receive this scan result |
| 292 | * (probe response or beacon). |
| 293 | * |
| 294 | * For Example: On devices with 2 hardware radio chains, this list could hold 1 or 2 |
| 295 | * entries based on whether this scan result was received using one or both the chains. |
| 296 | * {@hide} |
| 297 | */ |
| 298 | public RadioChainInfo[] radioChainInfos; |
| 299 | |
| 300 | /** |
Amin Shaikh | f9d47b7 | 2016-12-09 17:11:50 -0800 | [diff] [blame] | 301 | * Status indicating the scan result does not correspond to a user's saved configuration |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 302 | * @hide |
Jeff Sharkey | 8478911 | 2017-08-11 14:45:43 -0600 | [diff] [blame] | 303 | * @removed |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 304 | */ |
Amin Shaikh | f9d47b7 | 2016-12-09 17:11:50 -0800 | [diff] [blame] | 305 | @SystemApi |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 306 | public boolean untrusted; |
| 307 | |
| 308 | /** |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 309 | * Number of time autojoin used it |
| 310 | * @hide |
| 311 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 312 | @UnsupportedAppUsage |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 313 | public int numUsage; |
| 314 | |
| 315 | /** |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 316 | * The approximate distance to the AP in centimeter, if available. Else |
| 317 | * {@link UNSPECIFIED}. |
| 318 | * {@hide} |
| 319 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 320 | @UnsupportedAppUsage |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 321 | public int distanceCm; |
| 322 | |
| 323 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 324 | * The standard deviation of the distance to the access point, if available. |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 325 | * Else {@link UNSPECIFIED}. |
| 326 | * {@hide} |
| 327 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 328 | @UnsupportedAppUsage |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 329 | public int distanceSdCm; |
| 330 | |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 331 | /** {@hide} */ |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 332 | public static final long FLAG_PASSPOINT_NETWORK = 0x0000000000000001; |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 333 | |
| 334 | /** {@hide} */ |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 335 | public static final long FLAG_80211mc_RESPONDER = 0x0000000000000002; |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 336 | |
Samuel Tan | 40b5617 | 2016-03-23 14:21:28 -0700 | [diff] [blame] | 337 | /* |
| 338 | * These flags are specific to the ScanResult class, and are not related to the |flags| |
| 339 | * field of the per-BSS scan results from WPA supplicant. |
| 340 | */ |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 341 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 342 | * Defines flags; such as {@link #FLAG_PASSPOINT_NETWORK}. |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 343 | * {@hide} |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 344 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 345 | @UnsupportedAppUsage |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 346 | public long flags; |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 347 | |
| 348 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 349 | * sets a flag in {@link #flags} field |
| 350 | * @param flag flag to set |
| 351 | * @hide |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 352 | */ |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 353 | public void setFlag(long flag) { |
| 354 | flags |= flag; |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * clears a flag in {@link #flags} field |
| 359 | * @param flag flag to set |
| 360 | * @hide |
| 361 | */ |
| 362 | public void clearFlag(long flag) { |
| 363 | flags &= ~flag; |
| 364 | } |
| 365 | |
| 366 | public boolean is80211mcResponder() { |
| 367 | return (flags & FLAG_80211mc_RESPONDER) != 0; |
| 368 | } |
| 369 | |
| 370 | public boolean isPasspointNetwork() { |
| 371 | return (flags & FLAG_PASSPOINT_NETWORK) != 0; |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * Indicates venue name (such as 'San Francisco Airport') published by access point; only |
Peter Qiu | 6bbc895 | 2017-03-21 18:42:55 -0700 | [diff] [blame] | 376 | * available on Passpoint network and if published by access point. |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 377 | */ |
| 378 | public CharSequence venueName; |
| 379 | |
| 380 | /** |
Peter Qiu | 6bbc895 | 2017-03-21 18:42:55 -0700 | [diff] [blame] | 381 | * Indicates Passpoint operator name published by access point. |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 382 | */ |
| 383 | public CharSequence operatorFriendlyName; |
Vinit Deshpande | 7dd2f6b | 2015-01-02 11:36:27 -0800 | [diff] [blame] | 384 | |
| 385 | /** |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 386 | * {@hide} |
| 387 | */ |
| 388 | public final static int UNSPECIFIED = -1; |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 389 | /** |
| 390 | * @hide |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 391 | */ |
| 392 | public boolean is24GHz() { |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 393 | return ScanResult.is24GHz(frequency); |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | /** |
| 397 | * @hide |
| 398 | * TODO: makes real freq boundaries |
| 399 | */ |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 400 | public static boolean is24GHz(int freq) { |
| 401 | return freq > 2400 && freq < 2500; |
| 402 | } |
| 403 | |
| 404 | /** |
| 405 | * @hide |
| 406 | */ |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 407 | public boolean is5GHz() { |
vandwalle | ec5a901 | 2014-07-28 20:48:33 -0700 | [diff] [blame] | 408 | return ScanResult.is5GHz(frequency); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 409 | } |
| 410 | |
| 411 | /** |
| 412 | * @hide |
| 413 | * TODO: makes real freq boundaries |
| 414 | */ |
| 415 | public static boolean is5GHz(int freq) { |
| 416 | return freq > 4900 && freq < 5900; |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 417 | } |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 418 | |
Pierre Vandwalle | fc197d3 | 2015-04-14 15:33:22 -0700 | [diff] [blame] | 419 | /** |
| 420 | * @hide |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 421 | * anqp lines from supplicant BSS response |
| 422 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 423 | @UnsupportedAppUsage |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 424 | public List<String> anqpLines; |
| 425 | |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 426 | /** information elements from beacon |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 427 | * @hide |
| 428 | */ |
| 429 | public static class InformationElement { |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 430 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 431 | public static final int EID_SSID = 0; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 432 | @UnsupportedAppUsage |
Glen Kuhne | bff37ec | 2016-03-01 14:32:28 -0800 | [diff] [blame] | 433 | public static final int EID_SUPPORTED_RATES = 1; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 434 | @UnsupportedAppUsage |
Glen Kuhne | b6cd6fa | 2016-02-10 15:08:33 -0800 | [diff] [blame] | 435 | public static final int EID_TIM = 5; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 436 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 437 | public static final int EID_BSS_LOAD = 11; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 438 | @UnsupportedAppUsage |
Glen Kuhne | bff37ec | 2016-03-01 14:32:28 -0800 | [diff] [blame] | 439 | public static final int EID_ERP = 42; |
Etan Cohen | 67f5ffb | 2018-04-26 17:49:20 -0700 | [diff] [blame] | 440 | public static final int EID_HT_CAPABILITIES = 45; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 441 | @UnsupportedAppUsage |
Randy Pan | c0e86b2 | 2016-02-04 14:54:03 -0800 | [diff] [blame] | 442 | public static final int EID_RSN = 48; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 443 | @UnsupportedAppUsage |
Glen Kuhne | bff37ec | 2016-03-01 14:32:28 -0800 | [diff] [blame] | 444 | public static final int EID_EXTENDED_SUPPORTED_RATES = 50; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 445 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 446 | public static final int EID_HT_OPERATION = 61; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 447 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 448 | public static final int EID_INTERWORKING = 107; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 449 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 450 | public static final int EID_ROAMING_CONSORTIUM = 111; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 451 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 452 | public static final int EID_EXTENDED_CAPS = 127; |
Etan Cohen | 67f5ffb | 2018-04-26 17:49:20 -0700 | [diff] [blame] | 453 | public static final int EID_VHT_CAPABILITIES = 191; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 454 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 455 | public static final int EID_VHT_OPERATION = 192; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 456 | @UnsupportedAppUsage |
Mitchell Wills | 21c748d | 2015-07-28 09:56:53 -0700 | [diff] [blame] | 457 | public static final int EID_VSA = 221; |
| 458 | |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 459 | @UnsupportedAppUsage |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 460 | public int id; |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 461 | @UnsupportedAppUsage |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 462 | public byte[] bytes; |
Vinit Deshpande | ea676a0 | 2014-07-29 15:52:20 -0700 | [diff] [blame] | 463 | |
| 464 | public InformationElement() { |
| 465 | } |
| 466 | |
| 467 | public InformationElement(InformationElement rhs) { |
| 468 | this.id = rhs.id; |
| 469 | this.bytes = rhs.bytes.clone(); |
| 470 | } |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | /** information elements found in the beacon |
| 474 | * @hide |
| 475 | */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 476 | @UnsupportedAppUsage |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 477 | public InformationElement[] informationElements; |
| 478 | |
| 479 | /** ANQP response elements. |
| 480 | * @hide |
| 481 | */ |
| 482 | public AnqpInformationElement[] anqpElements; |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 483 | |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 484 | /** |
| 485 | * Flag indicating if this AP is a carrier AP. The determination is based |
| 486 | * on the AP's SSID and if AP is using EAP security. |
| 487 | * |
| 488 | * @hide |
| 489 | */ |
| 490 | public boolean isCarrierAp; |
| 491 | |
| 492 | /** |
| 493 | * The EAP type {@link WifiEnterpriseConfig.Eap} associated with this AP if it is a carrier AP. |
| 494 | * |
| 495 | * @hide |
| 496 | */ |
| 497 | public int carrierApEapType; |
| 498 | |
| 499 | /** |
| 500 | * The name of the carrier that's associated with this AP if it is a carrier AP. |
| 501 | * |
| 502 | * @hide |
| 503 | */ |
| 504 | public String carrierName; |
| 505 | |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 506 | /** {@hide} */ |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 507 | public ScanResult(WifiSsid wifiSsid, String BSSID, long hessid, int anqpDomainId, |
| 508 | byte[] osuProviders, String caps, int level, int frequency, long tsf) { |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 509 | this.wifiSsid = wifiSsid; |
| 510 | this.SSID = (wifiSsid != null) ? wifiSsid.toString() : WifiSsid.NONE; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 511 | this.BSSID = BSSID; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 512 | this.hessid = hessid; |
| 513 | this.anqpDomainId = anqpDomainId; |
| 514 | if (osuProviders != null) { |
| 515 | this.anqpElements = new AnqpInformationElement[1]; |
| 516 | this.anqpElements[0] = |
| 517 | new AnqpInformationElement(AnqpInformationElement.HOTSPOT20_VENDOR_ID, |
| 518 | AnqpInformationElement.HS_OSU_PROVIDERS, osuProviders); |
| 519 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 520 | this.capabilities = caps; |
| 521 | this.level = level; |
| 522 | this.frequency = frequency; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 523 | this.timestamp = tsf; |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 524 | this.distanceCm = UNSPECIFIED; |
| 525 | this.distanceSdCm = UNSPECIFIED; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 526 | this.channelWidth = UNSPECIFIED; |
| 527 | this.centerFreq0 = UNSPECIFIED; |
| 528 | this.centerFreq1 = UNSPECIFIED; |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 529 | this.flags = 0; |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 530 | this.isCarrierAp = false; |
| 531 | this.carrierApEapType = UNSPECIFIED; |
| 532 | this.carrierName = null; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 533 | this.radioChainInfos = null; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 534 | } |
| 535 | |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 536 | /** {@hide} */ |
| 537 | public ScanResult(WifiSsid wifiSsid, String BSSID, String caps, int level, int frequency, |
| 538 | long tsf, int distCm, int distSdCm) { |
| 539 | this.wifiSsid = wifiSsid; |
| 540 | this.SSID = (wifiSsid != null) ? wifiSsid.toString() : WifiSsid.NONE; |
| 541 | this.BSSID = BSSID; |
| 542 | this.capabilities = caps; |
| 543 | this.level = level; |
| 544 | this.frequency = frequency; |
| 545 | this.timestamp = tsf; |
| 546 | this.distanceCm = distCm; |
| 547 | this.distanceSdCm = distSdCm; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 548 | this.channelWidth = UNSPECIFIED; |
| 549 | this.centerFreq0 = UNSPECIFIED; |
| 550 | this.centerFreq1 = UNSPECIFIED; |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 551 | this.flags = 0; |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 552 | this.isCarrierAp = false; |
| 553 | this.carrierApEapType = UNSPECIFIED; |
| 554 | this.carrierName = null; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 555 | this.radioChainInfos = null; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | /** {@hide} */ |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 559 | public ScanResult(String Ssid, String BSSID, long hessid, int anqpDomainId, String caps, |
| 560 | int level, int frequency, |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 561 | long tsf, int distCm, int distSdCm, int channelWidth, int centerFreq0, int centerFreq1, |
| 562 | boolean is80211McRTTResponder) { |
xinhe | f2c0104 | 2015-07-31 12:50:55 -0700 | [diff] [blame] | 563 | this.SSID = Ssid; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 564 | this.BSSID = BSSID; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 565 | this.hessid = hessid; |
| 566 | this.anqpDomainId = anqpDomainId; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 567 | this.capabilities = caps; |
| 568 | this.level = level; |
| 569 | this.frequency = frequency; |
| 570 | this.timestamp = tsf; |
| 571 | this.distanceCm = distCm; |
| 572 | this.distanceSdCm = distSdCm; |
| 573 | this.channelWidth = channelWidth; |
| 574 | this.centerFreq0 = centerFreq0; |
| 575 | this.centerFreq1 = centerFreq1; |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 576 | if (is80211McRTTResponder) { |
| 577 | this.flags = FLAG_80211mc_RESPONDER; |
| 578 | } else { |
| 579 | this.flags = 0; |
| 580 | } |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 581 | this.isCarrierAp = false; |
| 582 | this.carrierApEapType = UNSPECIFIED; |
| 583 | this.carrierName = null; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 584 | this.radioChainInfos = null; |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 585 | } |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 586 | |
xinhe | f2c0104 | 2015-07-31 12:50:55 -0700 | [diff] [blame] | 587 | /** {@hide} */ |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 588 | public ScanResult(WifiSsid wifiSsid, String Ssid, String BSSID, long hessid, int anqpDomainId, |
| 589 | String caps, int level, |
xinhe | f2c0104 | 2015-07-31 12:50:55 -0700 | [diff] [blame] | 590 | int frequency, long tsf, int distCm, int distSdCm, int channelWidth, |
| 591 | int centerFreq0, int centerFreq1, boolean is80211McRTTResponder) { |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 592 | this(Ssid, BSSID, hessid, anqpDomainId, caps, level, frequency, tsf, distCm, |
| 593 | distSdCm, channelWidth, centerFreq0, centerFreq1, is80211McRTTResponder); |
xinhe | f2c0104 | 2015-07-31 12:50:55 -0700 | [diff] [blame] | 594 | this.wifiSsid = wifiSsid; |
| 595 | } |
| 596 | |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 597 | /** copy constructor {@hide} */ |
| 598 | public ScanResult(ScanResult source) { |
| 599 | if (source != null) { |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 600 | wifiSsid = source.wifiSsid; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 601 | SSID = source.SSID; |
| 602 | BSSID = source.BSSID; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 603 | hessid = source.hessid; |
| 604 | anqpDomainId = source.anqpDomainId; |
| 605 | informationElements = source.informationElements; |
| 606 | anqpElements = source.anqpElements; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 607 | capabilities = source.capabilities; |
| 608 | level = source.level; |
| 609 | frequency = source.frequency; |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 610 | channelWidth = source.channelWidth; |
| 611 | centerFreq0 = source.centerFreq0; |
| 612 | centerFreq1 = source.centerFreq1; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 613 | timestamp = source.timestamp; |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 614 | distanceCm = source.distanceCm; |
| 615 | distanceSdCm = source.distanceSdCm; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 616 | seen = source.seen; |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 617 | untrusted = source.untrusted; |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 618 | numUsage = source.numUsage; |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 619 | venueName = source.venueName; |
| 620 | operatorFriendlyName = source.operatorFriendlyName; |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 621 | flags = source.flags; |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 622 | isCarrierAp = source.isCarrierAp; |
| 623 | carrierApEapType = source.carrierApEapType; |
| 624 | carrierName = source.carrierName; |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 625 | radioChainInfos = source.radioChainInfos; |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 626 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 627 | } |
| 628 | |
Vinit Deshapnde | 011e1b3 | 2014-05-07 21:09:11 -0700 | [diff] [blame] | 629 | /** empty scan result |
| 630 | * |
| 631 | * {@hide} |
| 632 | * */ |
| 633 | public ScanResult() { |
| 634 | } |
| 635 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 636 | @Override |
| 637 | public String toString() { |
| 638 | StringBuffer sb = new StringBuffer(); |
| 639 | String none = "<none>"; |
| 640 | |
| 641 | sb.append("SSID: "). |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 642 | append(wifiSsid == null ? WifiSsid.NONE : wifiSsid). |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 643 | append(", BSSID: "). |
| 644 | append(BSSID == null ? none : BSSID). |
| 645 | append(", capabilities: "). |
| 646 | append(capabilities == null ? none : capabilities). |
| 647 | append(", level: "). |
| 648 | append(level). |
| 649 | append(", frequency: "). |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 650 | append(frequency). |
| 651 | append(", timestamp: "). |
| 652 | append(timestamp); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 653 | |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 654 | sb.append(", distance: ").append((distanceCm != UNSPECIFIED ? distanceCm : "?")). |
| 655 | append("(cm)"); |
| 656 | sb.append(", distanceSd: ").append((distanceSdCm != UNSPECIFIED ? distanceSdCm : "?")). |
| 657 | append("(cm)"); |
| 658 | |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 659 | sb.append(", passpoint: "); |
| 660 | sb.append(((flags & FLAG_PASSPOINT_NETWORK) != 0) ? "yes" : "no"); |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 661 | sb.append(", ChannelBandwidth: ").append(channelWidth); |
| 662 | sb.append(", centerFreq0: ").append(centerFreq0); |
| 663 | sb.append(", centerFreq1: ").append(centerFreq1); |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 664 | sb.append(", 80211mcResponder: "); |
| 665 | sb.append(((flags & FLAG_80211mc_RESPONDER) != 0) ? "is supported" : "is not supported"); |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 666 | sb.append(", Carrier AP: ").append(isCarrierAp ? "yes" : "no"); |
| 667 | sb.append(", Carrier AP EAP Type: ").append(carrierApEapType); |
| 668 | sb.append(", Carrier name: ").append(carrierName); |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 669 | sb.append(", Radio Chain Infos: ").append(Arrays.toString(radioChainInfos)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 670 | return sb.toString(); |
| 671 | } |
| 672 | |
| 673 | /** Implement the Parcelable interface {@hide} */ |
| 674 | public int describeContents() { |
| 675 | return 0; |
| 676 | } |
| 677 | |
| 678 | /** Implement the Parcelable interface {@hide} */ |
| 679 | public void writeToParcel(Parcel dest, int flags) { |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 680 | if (wifiSsid != null) { |
| 681 | dest.writeInt(1); |
| 682 | wifiSsid.writeToParcel(dest, flags); |
| 683 | } else { |
| 684 | dest.writeInt(0); |
| 685 | } |
xinhe | f2c0104 | 2015-07-31 12:50:55 -0700 | [diff] [blame] | 686 | dest.writeString(SSID); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 687 | dest.writeString(BSSID); |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 688 | dest.writeLong(hessid); |
| 689 | dest.writeInt(anqpDomainId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 690 | dest.writeString(capabilities); |
| 691 | dest.writeInt(level); |
| 692 | dest.writeInt(frequency); |
Iliyan Malchev | 06c43d5 | 2012-08-20 12:52:35 -0700 | [diff] [blame] | 693 | dest.writeLong(timestamp); |
Robert Greenwalt | 0451d59 | 2013-08-01 18:24:13 -0700 | [diff] [blame] | 694 | dest.writeInt(distanceCm); |
| 695 | dest.writeInt(distanceSdCm); |
xinhe | 6e58424 | 2015-03-02 14:04:35 -0800 | [diff] [blame] | 696 | dest.writeInt(channelWidth); |
| 697 | dest.writeInt(centerFreq0); |
| 698 | dest.writeInt(centerFreq1); |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 699 | dest.writeLong(seen); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 700 | dest.writeInt(untrusted ? 1 : 0); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 701 | dest.writeInt(numUsage); |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 702 | dest.writeString((venueName != null) ? venueName.toString() : ""); |
| 703 | dest.writeString((operatorFriendlyName != null) ? operatorFriendlyName.toString() : ""); |
| 704 | dest.writeLong(this.flags); |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 705 | |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 706 | if (informationElements != null) { |
| 707 | dest.writeInt(informationElements.length); |
| 708 | for (int i = 0; i < informationElements.length; i++) { |
| 709 | dest.writeInt(informationElements[i].id); |
| 710 | dest.writeInt(informationElements[i].bytes.length); |
| 711 | dest.writeByteArray(informationElements[i].bytes); |
| 712 | } |
| 713 | } else { |
| 714 | dest.writeInt(0); |
| 715 | } |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 716 | |
| 717 | if (anqpLines != null) { |
| 718 | dest.writeInt(anqpLines.size()); |
| 719 | for (int i = 0; i < anqpLines.size(); i++) { |
| 720 | dest.writeString(anqpLines.get(i)); |
| 721 | } |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 722 | } |
Jan Nordqvist | 7a50441 | 2016-02-03 14:26:21 -0800 | [diff] [blame] | 723 | else { |
| 724 | dest.writeInt(0); |
| 725 | } |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 726 | if (anqpElements != null) { |
| 727 | dest.writeInt(anqpElements.length); |
| 728 | for (AnqpInformationElement element : anqpElements) { |
| 729 | dest.writeInt(element.getVendorId()); |
| 730 | dest.writeInt(element.getElementId()); |
| 731 | dest.writeInt(element.getPayload().length); |
| 732 | dest.writeByteArray(element.getPayload()); |
| 733 | } |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 734 | } else { |
| 735 | dest.writeInt(0); |
| 736 | } |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 737 | dest.writeInt(isCarrierAp ? 1 : 0); |
| 738 | dest.writeInt(carrierApEapType); |
| 739 | dest.writeString(carrierName); |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 740 | |
| 741 | if (radioChainInfos != null) { |
| 742 | dest.writeInt(radioChainInfos.length); |
| 743 | for (int i = 0; i < radioChainInfos.length; i++) { |
| 744 | dest.writeInt(radioChainInfos[i].id); |
| 745 | dest.writeInt(radioChainInfos[i].level); |
| 746 | } |
| 747 | } else { |
| 748 | dest.writeInt(0); |
| 749 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | /** Implement the Parcelable interface {@hide} */ |
Mathew Inwood | 53f089f | 2018-08-08 14:44:44 +0100 | [diff] [blame] | 753 | @UnsupportedAppUsage |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame^] | 754 | public static final @android.annotation.NonNull Creator<ScanResult> CREATOR = |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 755 | new Creator<ScanResult>() { |
| 756 | public ScanResult createFromParcel(Parcel in) { |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 757 | WifiSsid wifiSsid = null; |
| 758 | if (in.readInt() == 1) { |
| 759 | wifiSsid = WifiSsid.CREATOR.createFromParcel(in); |
| 760 | } |
Yuhao Zheng | a486447 | 2014-04-10 11:45:42 -0700 | [diff] [blame] | 761 | ScanResult sr = new ScanResult( |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 762 | wifiSsid, |
| 763 | in.readString(), /* SSID */ |
| 764 | in.readString(), /* BSSID */ |
| 765 | in.readLong(), /* HESSID */ |
| 766 | in.readInt(), /* ANQP Domain ID */ |
| 767 | in.readString(), /* capabilities */ |
| 768 | in.readInt(), /* level */ |
| 769 | in.readInt(), /* frequency */ |
| 770 | in.readLong(), /* timestamp */ |
| 771 | in.readInt(), /* distanceCm */ |
| 772 | in.readInt(), /* distanceSdCm */ |
| 773 | in.readInt(), /* channelWidth */ |
| 774 | in.readInt(), /* centerFreq0 */ |
| 775 | in.readInt(), /* centerFreq1 */ |
| 776 | false /* rtt responder, |
| 777 | fixed with flags below */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 778 | ); |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 779 | |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 780 | sr.seen = in.readLong(); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 781 | sr.untrusted = in.readInt() != 0; |
vandwalle | b1dce02 | 2014-08-27 01:00:11 -0700 | [diff] [blame] | 782 | sr.numUsage = in.readInt(); |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 783 | sr.venueName = in.readString(); |
| 784 | sr.operatorFriendlyName = in.readString(); |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 785 | sr.flags = in.readLong(); |
Vinit Deshpande | 55027bb | 2014-05-29 15:58:48 -0700 | [diff] [blame] | 786 | int n = in.readInt(); |
| 787 | if (n != 0) { |
| 788 | sr.informationElements = new InformationElement[n]; |
| 789 | for (int i = 0; i < n; i++) { |
| 790 | sr.informationElements[i] = new InformationElement(); |
| 791 | sr.informationElements[i].id = in.readInt(); |
| 792 | int len = in.readInt(); |
| 793 | sr.informationElements[i].bytes = new byte[len]; |
| 794 | in.readByteArray(sr.informationElements[i].bytes); |
| 795 | } |
| 796 | } |
Mitchell Wills | 9eeba37 | 2016-01-27 22:58:16 -0800 | [diff] [blame] | 797 | |
| 798 | n = in.readInt(); |
| 799 | if (n != 0) { |
| 800 | sr.anqpLines = new ArrayList<String>(); |
| 801 | for (int i = 0; i < n; i++) { |
| 802 | sr.anqpLines.add(in.readString()); |
| 803 | } |
| 804 | } |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 805 | n = in.readInt(); |
| 806 | if (n != 0) { |
| 807 | sr.anqpElements = new AnqpInformationElement[n]; |
| 808 | for (int i = 0; i < n; i++) { |
| 809 | int vendorId = in.readInt(); |
| 810 | int elementId = in.readInt(); |
| 811 | int len = in.readInt(); |
| 812 | byte[] payload = new byte[len]; |
| 813 | in.readByteArray(payload); |
Jan Nordqvist | 7a50441 | 2016-02-03 14:26:21 -0800 | [diff] [blame] | 814 | sr.anqpElements[i] = |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 815 | new AnqpInformationElement(vendorId, elementId, payload); |
| 816 | } |
| 817 | } |
Peter Qiu | d3ad154 | 2017-07-20 14:43:52 -0700 | [diff] [blame] | 818 | sr.isCarrierAp = in.readInt() != 0; |
| 819 | sr.carrierApEapType = in.readInt(); |
| 820 | sr.carrierName = in.readString(); |
Roshan Pius | 4f17615 | 2017-10-27 15:12:51 -0700 | [diff] [blame] | 821 | n = in.readInt(); |
| 822 | if (n != 0) { |
| 823 | sr.radioChainInfos = new RadioChainInfo[n]; |
| 824 | for (int i = 0; i < n; i++) { |
| 825 | sr.radioChainInfos[i] = new RadioChainInfo(); |
| 826 | sr.radioChainInfos[i].id = in.readInt(); |
| 827 | sr.radioChainInfos[i].level = in.readInt(); |
| 828 | } |
| 829 | } |
Yuhao Zheng | a486447 | 2014-04-10 11:45:42 -0700 | [diff] [blame] | 830 | return sr; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | public ScanResult[] newArray(int size) { |
| 834 | return new ScanResult[size]; |
| 835 | } |
| 836 | }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 837 | } |