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 | |
Chelsea Derrick | adae06b | 2014-07-16 12:53:40 -0700 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 20 | import android.content.pm.PackageManager; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 21 | import android.net.IpConfiguration; |
| 22 | import android.net.IpConfiguration.ProxySettings; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 23 | import android.net.ProxyInfo; |
Lorenzo Colitti | 0a82e80 | 2014-07-31 00:48:01 +0900 | [diff] [blame] | 24 | import android.net.StaticIpConfiguration; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import android.os.Parcel; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 26 | import android.os.Parcelable; |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 27 | import android.os.UserHandle; |
Irfan Sheriff | 26d0076 | 2013-02-05 09:44:12 -0800 | [diff] [blame] | 28 | import android.text.TextUtils; |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 29 | import android.util.BackupUtils; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 30 | |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 31 | import java.io.ByteArrayOutputStream; |
| 32 | import java.io.DataInputStream; |
| 33 | import java.io.DataOutputStream; |
| 34 | import java.io.IOException; |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 35 | import java.util.Arrays; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | import java.util.BitSet; |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 37 | import java.util.HashMap; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * A class representing a configured Wi-Fi network, including the |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 41 | * security configuration. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 42 | */ |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 43 | public class WifiConfiguration implements Parcelable { |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 44 | private static final String TAG = "WifiConfiguration"; |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 45 | /** |
| 46 | * Current Version of the Backup Serializer. |
| 47 | */ |
| 48 | private static final int BACKUP_VERSION = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 49 | /** {@hide} */ |
| 50 | public static final String ssidVarName = "ssid"; |
| 51 | /** {@hide} */ |
| 52 | public static final String bssidVarName = "bssid"; |
| 53 | /** {@hide} */ |
| 54 | public static final String pskVarName = "psk"; |
| 55 | /** {@hide} */ |
| 56 | public static final String[] wepKeyVarNames = { "wep_key0", "wep_key1", "wep_key2", "wep_key3" }; |
| 57 | /** {@hide} */ |
| 58 | public static final String wepTxKeyIdxVarName = "wep_tx_keyidx"; |
| 59 | /** {@hide} */ |
| 60 | public static final String priorityVarName = "priority"; |
| 61 | /** {@hide} */ |
| 62 | public static final String hiddenSSIDVarName = "scan_ssid"; |
Irfan Sheriff | 5ee8980 | 2010-09-16 17:53:34 -0700 | [diff] [blame] | 63 | /** {@hide} */ |
Yuhao Zheng | 5f9385f | 2014-06-30 15:32:08 -0700 | [diff] [blame] | 64 | public static final String pmfVarName = "ieee80211w"; |
| 65 | /** {@hide} */ |
| 66 | public static final String updateIdentiferVarName = "update_identifier"; |
| 67 | /** {@hide} */ |
Irfan Sheriff | 5ee8980 | 2010-09-16 17:53:34 -0700 | [diff] [blame] | 68 | public static final int INVALID_NETWORK_ID = -1; |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 69 | |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 70 | /** {@hide} */ |
| 71 | private String mPasspointManagementObjectTree; |
| 72 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 73 | /** |
| 74 | * Recognized key management schemes. |
| 75 | */ |
| 76 | public static class KeyMgmt { |
| 77 | private KeyMgmt() { } |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 78 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 79 | /** WPA is not used; plaintext or static WEP could be used. */ |
| 80 | public static final int NONE = 0; |
| 81 | /** WPA pre-shared key (requires {@code preSharedKey} to be specified). */ |
| 82 | public static final int WPA_PSK = 1; |
| 83 | /** WPA using EAP authentication. Generally used with an external authentication server. */ |
| 84 | public static final int WPA_EAP = 2; |
| 85 | /** IEEE 802.1X using EAP authentication and (optionally) dynamically |
| 86 | * generated WEP keys. */ |
| 87 | public static final int IEEE8021X = 3; |
| 88 | |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 89 | /** WPA2 pre-shared key for use with soft access point |
| 90 | * (requires {@code preSharedKey} to be specified). |
| 91 | * @hide |
| 92 | */ |
Jeremy Klein | b625377 | 2016-01-06 11:47:03 -0800 | [diff] [blame] | 93 | @SystemApi |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 94 | public static final int WPA2_PSK = 4; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 95 | /** |
| 96 | * Hotspot 2.0 r2 OSEN: |
| 97 | * @hide |
| 98 | */ |
| 99 | public static final int OSEN = 5; |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 100 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 101 | public static final String varName = "key_mgmt"; |
| 102 | |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 103 | public static final String[] strings = { "NONE", "WPA_PSK", "WPA_EAP", "IEEE8021X", |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 104 | "WPA2_PSK", "OSEN" }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 105 | } |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 106 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 107 | /** |
| 108 | * Recognized security protocols. |
| 109 | */ |
| 110 | public static class Protocol { |
| 111 | private Protocol() { } |
| 112 | |
| 113 | /** WPA/IEEE 802.11i/D3.0 */ |
| 114 | public static final int WPA = 0; |
| 115 | /** WPA2/IEEE 802.11i */ |
| 116 | public static final int RSN = 1; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 117 | /** HS2.0 r2 OSEN |
| 118 | * @hide |
| 119 | */ |
| 120 | public static final int OSEN = 2; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 121 | |
| 122 | public static final String varName = "proto"; |
| 123 | |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 124 | public static final String[] strings = { "WPA", "RSN", "OSEN" }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Recognized IEEE 802.11 authentication algorithms. |
| 129 | */ |
| 130 | public static class AuthAlgorithm { |
| 131 | private AuthAlgorithm() { } |
| 132 | |
| 133 | /** Open System authentication (required for WPA/WPA2) */ |
| 134 | public static final int OPEN = 0; |
| 135 | /** Shared Key authentication (requires static WEP keys) */ |
| 136 | public static final int SHARED = 1; |
| 137 | /** LEAP/Network EAP (only used with LEAP) */ |
| 138 | public static final int LEAP = 2; |
| 139 | |
| 140 | public static final String varName = "auth_alg"; |
| 141 | |
| 142 | public static final String[] strings = { "OPEN", "SHARED", "LEAP" }; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Recognized pairwise ciphers for WPA. |
| 147 | */ |
| 148 | public static class PairwiseCipher { |
| 149 | private PairwiseCipher() { } |
| 150 | |
| 151 | /** Use only Group keys (deprecated) */ |
| 152 | public static final int NONE = 0; |
| 153 | /** Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] */ |
| 154 | public static final int TKIP = 1; |
| 155 | /** AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] */ |
| 156 | public static final int CCMP = 2; |
| 157 | |
| 158 | public static final String varName = "pairwise"; |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 159 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 160 | public static final String[] strings = { "NONE", "TKIP", "CCMP" }; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Recognized group ciphers. |
| 165 | * <pre> |
| 166 | * CCMP = AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] |
| 167 | * TKIP = Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] |
| 168 | * WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key |
| 169 | * WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key (original 802.11) |
| 170 | * </pre> |
| 171 | */ |
| 172 | public static class GroupCipher { |
| 173 | private GroupCipher() { } |
| 174 | |
| 175 | /** WEP40 = WEP (Wired Equivalent Privacy) with 40-bit key (original 802.11) */ |
| 176 | public static final int WEP40 = 0; |
| 177 | /** WEP104 = WEP (Wired Equivalent Privacy) with 104-bit key */ |
| 178 | public static final int WEP104 = 1; |
| 179 | /** Temporal Key Integrity Protocol [IEEE 802.11i/D7.0] */ |
| 180 | public static final int TKIP = 2; |
| 181 | /** AES in Counter mode with CBC-MAC [RFC 3610, IEEE 802.11i/D7.0] */ |
| 182 | public static final int CCMP = 3; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 183 | /** Hotspot 2.0 r2 OSEN |
| 184 | * @hide |
| 185 | */ |
| 186 | public static final int GTK_NOT_USED = 4; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 187 | |
| 188 | public static final String varName = "group"; |
| 189 | |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 190 | public static final String[] strings = |
| 191 | { "WEP40", "WEP104", "TKIP", "CCMP", "GTK_NOT_USED" }; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | /** Possible status of a network configuration. */ |
| 195 | public static class Status { |
| 196 | private Status() { } |
| 197 | |
| 198 | /** this is the network we are currently connected to */ |
| 199 | public static final int CURRENT = 0; |
| 200 | /** supplicant will not attempt to use this network */ |
| 201 | public static final int DISABLED = 1; |
| 202 | /** supplicant will consider this network available for association */ |
| 203 | public static final int ENABLED = 2; |
| 204 | |
| 205 | public static final String[] strings = { "current", "disabled", "enabled" }; |
| 206 | } |
| 207 | |
Isaac Levy | 8dc6a1b | 2011-07-27 08:00:03 -0700 | [diff] [blame] | 208 | /** @hide */ |
Lorenzo Colitti | 1ac50cb | 2015-04-06 17:19:19 +0900 | [diff] [blame] | 209 | public static final int UNKNOWN_UID = -1; |
| 210 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 211 | /** |
| 212 | * The ID number that the supplicant uses to identify this |
| 213 | * network configuration entry. This must be passed as an argument |
| 214 | * to most calls into the supplicant. |
| 215 | */ |
| 216 | public int networkId; |
| 217 | |
| 218 | /** |
| 219 | * The current status of this network configuration entry. |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 220 | * Fixme We need remove this field to use only Quality network selection status only |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | * @see Status |
| 222 | */ |
| 223 | public int status; |
Isaac Levy | 8dc6a1b | 2011-07-27 08:00:03 -0700 | [diff] [blame] | 224 | |
| 225 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 226 | * The network's SSID. Can either be an ASCII string, |
| 227 | * which must be enclosed in double quotation marks |
Ben Dodson | 4e8620f | 2010-08-25 10:55:47 -0700 | [diff] [blame] | 228 | * (e.g., {@code "MyNetwork"}, or a string of |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 229 | * hex digits,which are not enclosed in quotes |
| 230 | * (e.g., {@code 01a243f405}). |
| 231 | */ |
| 232 | public String SSID; |
| 233 | /** |
| 234 | * When set, this network configuration entry should only be used when |
| 235 | * associating with the AP having the specified BSSID. The value is |
| 236 | * a string in the format of an Ethernet MAC address, e.g., |
| 237 | * <code>XX:XX:XX:XX:XX:XX</code> where each <code>X</code> is a hex digit. |
| 238 | */ |
| 239 | public String BSSID; |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 240 | |
| 241 | /** |
Peter Qiu | d667616 | 2016-02-11 16:45:44 -0800 | [diff] [blame] | 242 | * 2GHz band. |
| 243 | * @hide |
| 244 | */ |
| 245 | public static final int AP_BAND_2GHZ = 0; |
| 246 | |
| 247 | /** |
| 248 | * 5GHz band. |
| 249 | * @hide |
| 250 | */ |
| 251 | public static final int AP_BAND_5GHZ = 1; |
| 252 | |
| 253 | /** |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 254 | * The band which AP resides on |
| 255 | * 0-2G 1-5G |
| 256 | * By default, 2G is chosen |
xinhe | 7e5e791 | 2015-04-21 15:42:03 -0700 | [diff] [blame] | 257 | * @hide |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 258 | */ |
Peter Qiu | d667616 | 2016-02-11 16:45:44 -0800 | [diff] [blame] | 259 | public int apBand = AP_BAND_2GHZ; |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 260 | |
| 261 | /** |
| 262 | * The channel which AP resides on,currently, US only |
| 263 | * 2G 1-11 |
| 264 | * 5G 36,40,44,48,149,153,157,161,165 |
| 265 | * 0 - find a random available channel according to the apBand |
xinhe | 7e5e791 | 2015-04-21 15:42:03 -0700 | [diff] [blame] | 266 | * @hide |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 267 | */ |
| 268 | public int apChannel = 0; |
| 269 | |
Yuhao Zheng | 8a9eb81 | 2014-05-27 10:35:02 -0700 | [diff] [blame] | 270 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 271 | * Pre-shared key for use with WPA-PSK. |
| 272 | * <p/> |
| 273 | * When the value of this key is read, the actual key is |
| 274 | * not returned, just a "*" if the key has a value, or the null |
| 275 | * string otherwise. |
| 276 | */ |
| 277 | public String preSharedKey; |
| 278 | /** |
| 279 | * Up to four WEP keys. Either an ASCII string enclosed in double |
Ben Dodson | 4e8620f | 2010-08-25 10:55:47 -0700 | [diff] [blame] | 280 | * quotation marks (e.g., {@code "abcdef"} or a string |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 281 | * of hex digits (e.g., {@code 0102030405}). |
| 282 | * <p/> |
| 283 | * When the value of one of these keys is read, the actual key is |
| 284 | * not returned, just a "*" if the key has a value, or the null |
| 285 | * string otherwise. |
| 286 | */ |
| 287 | public String[] wepKeys; |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 288 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 289 | /** Default WEP key index, ranging from 0 to 3. */ |
| 290 | public int wepTxKeyIndex; |
| 291 | |
| 292 | /** |
| 293 | * Priority determines the preference given to a network by {@code wpa_supplicant} |
| 294 | * when choosing an access point with which to associate. |
| 295 | */ |
| 296 | public int priority; |
| 297 | |
| 298 | /** |
| 299 | * This is a network that does not broadcast its SSID, so an |
| 300 | * SSID-specific probe request must be used for scans. |
| 301 | */ |
| 302 | public boolean hiddenSSID; |
| 303 | |
| 304 | /** |
Yuhao Zheng | 5f9385f | 2014-06-30 15:32:08 -0700 | [diff] [blame] | 305 | * This is a network that requries Protected Management Frames (PMF). |
| 306 | * @hide |
| 307 | */ |
| 308 | public boolean requirePMF; |
| 309 | |
| 310 | /** |
| 311 | * Update identifier, for Passpoint network. |
| 312 | * @hide |
| 313 | */ |
| 314 | public String updateIdentifier; |
| 315 | |
| 316 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 317 | * The set of key management protocols supported by this configuration. |
| 318 | * See {@link KeyMgmt} for descriptions of the values. |
| 319 | * Defaults to WPA-PSK WPA-EAP. |
| 320 | */ |
| 321 | public BitSet allowedKeyManagement; |
| 322 | /** |
| 323 | * The set of security protocols supported by this configuration. |
| 324 | * See {@link Protocol} for descriptions of the values. |
| 325 | * Defaults to WPA RSN. |
| 326 | */ |
| 327 | public BitSet allowedProtocols; |
| 328 | /** |
| 329 | * The set of authentication protocols supported by this configuration. |
| 330 | * See {@link AuthAlgorithm} for descriptions of the values. |
| 331 | * Defaults to automatic selection. |
| 332 | */ |
| 333 | public BitSet allowedAuthAlgorithms; |
| 334 | /** |
| 335 | * The set of pairwise ciphers for WPA supported by this configuration. |
| 336 | * See {@link PairwiseCipher} for descriptions of the values. |
| 337 | * Defaults to CCMP TKIP. |
| 338 | */ |
| 339 | public BitSet allowedPairwiseCiphers; |
| 340 | /** |
| 341 | * The set of group ciphers supported by this configuration. |
| 342 | * See {@link GroupCipher} for descriptions of the values. |
| 343 | * Defaults to CCMP TKIP WEP104 WEP40. |
| 344 | */ |
| 345 | public BitSet allowedGroupCiphers; |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 346 | /** |
Irfan Sheriff | 26d0076 | 2013-02-05 09:44:12 -0800 | [diff] [blame] | 347 | * The enterprise configuration details specifying the EAP method, |
| 348 | * certificates and other settings associated with the EAP. |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 349 | */ |
| 350 | public WifiEnterpriseConfig enterpriseConfig; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 351 | |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 352 | /** |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 353 | * Fully qualified domain name of a passpoint configuration |
| 354 | */ |
| 355 | public String FQDN; |
| 356 | |
| 357 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 358 | * Name of passpoint credential provider |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 359 | */ |
| 360 | public String providerFriendlyName; |
| 361 | |
| 362 | /** |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 363 | * Roaming Consortium Id list for passpoint credential; identifies a set of networks where |
| 364 | * passpoint credential will be considered valid |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 365 | */ |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 366 | public long[] roamingConsortiumIds; |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 367 | |
| 368 | /** |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 369 | * @hide |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 370 | * This network configuration is visible to and usable by other users on the |
| 371 | * same device. |
| 372 | */ |
| 373 | public boolean shared; |
| 374 | |
| 375 | /** |
| 376 | * @hide |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 377 | */ |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 378 | private IpConfiguration mIpConfiguration; |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 379 | |
| 380 | /** |
| 381 | * @hide |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 382 | * dhcp server MAC address if known |
| 383 | */ |
| 384 | public String dhcpServer; |
| 385 | |
| 386 | /** |
| 387 | * @hide |
| 388 | * default Gateway MAC address if known |
| 389 | */ |
| 390 | public String defaultGwMacAddress; |
| 391 | |
| 392 | /** |
| 393 | * @hide |
vandwalle | 3a74e2ef | 2014-05-21 21:21:00 -0700 | [diff] [blame] | 394 | * last failure |
| 395 | */ |
| 396 | public String lastFailure; |
| 397 | |
| 398 | /** |
| 399 | * @hide |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 400 | * last time we connected, this configuration had validated internet access |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 401 | */ |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 402 | public boolean validatedInternetAccess; |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 403 | |
| 404 | /** |
| 405 | * @hide |
Glen Kuhne | b6cd6fa | 2016-02-10 15:08:33 -0800 | [diff] [blame] | 406 | * The number of beacon intervals between Delivery Traffic Indication Maps (DTIM) |
| 407 | * This value is populated from scan results that contain Beacon Frames, which are infrequent. |
| 408 | * The value is not guaranteed to be set or current (Although it SHOULDNT change once set) |
| 409 | * Valid values are from 1 - 255. Initialized here as 0, use this to check if set. |
| 410 | */ |
| 411 | public int dtimInterval = 0; |
| 412 | |
| 413 | /** |
| 414 | * @hide |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 415 | * Uid of app creating the configuration |
| 416 | */ |
Chelsea Derrick | adae06b | 2014-07-16 12:53:40 -0700 | [diff] [blame] | 417 | @SystemApi |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 418 | public int creatorUid; |
| 419 | |
| 420 | /** |
| 421 | * @hide |
| 422 | * Uid of last app issuing a connection related command |
| 423 | */ |
| 424 | public int lastConnectUid; |
| 425 | |
| 426 | /** |
| 427 | * @hide |
| 428 | * Uid of last app modifying the configuration |
| 429 | */ |
Chelsea Derrick | eb8f329 | 2014-07-24 12:50:40 -0700 | [diff] [blame] | 430 | @SystemApi |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 431 | public int lastUpdateUid; |
| 432 | |
| 433 | /** |
| 434 | * @hide |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 435 | * Universal name for app creating the configuration |
| 436 | * see {#link {@link PackageManager#getNameForUid(int)} |
| 437 | */ |
| 438 | @SystemApi |
| 439 | public String creatorName; |
| 440 | |
| 441 | /** |
| 442 | * @hide |
| 443 | * Universal name for app updating the configuration |
| 444 | * see {#link {@link PackageManager#getNameForUid(int)} |
| 445 | */ |
| 446 | @SystemApi |
| 447 | public String lastUpdateName; |
| 448 | |
| 449 | /** |
| 450 | * @hide |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 451 | * Status of user approval for connection |
| 452 | */ |
| 453 | public int userApproved = USER_UNSPECIFIED; |
| 454 | |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 455 | /** The Below RSSI thresholds are used to configure AutoJoin |
| 456 | * - GOOD/LOW/BAD thresholds are used so as to calculate link score |
vandwalle | 2e93c38f | 2014-09-13 12:53:26 -0700 | [diff] [blame] | 457 | * - UNWANTED_SOFT are used by the blacklisting logic so as to handle |
| 458 | * the unwanted network message coming from CS |
| 459 | * - UNBLACKLIST thresholds are used so as to tweak the speed at which |
| 460 | * the network is unblacklisted (i.e. if |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 461 | * it is seen with good RSSI, it is blacklisted faster) |
vandwalle | 2e93c38f | 2014-09-13 12:53:26 -0700 | [diff] [blame] | 462 | * - INITIAL_AUTOJOIN_ATTEMPT, used to determine how close from |
| 463 | * the network we need to be before autojoin kicks in |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 464 | */ |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 465 | /** @hide **/ |
| 466 | public static int INVALID_RSSI = -127; |
| 467 | |
| 468 | /** |
| 469 | * @hide |
| 470 | * A summary of the RSSI and Band status for that configuration |
| 471 | * This is used as a temporary value by the auto-join controller |
| 472 | */ |
Vinit Deshpande | 6f6c781 | 2015-03-27 11:40:17 -0700 | [diff] [blame] | 473 | public static final class Visibility { |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 474 | public int rssi5; // strongest 5GHz RSSI |
| 475 | public int rssi24; // strongest 2.4GHz RSSI |
| 476 | public int num5; // number of BSSIDs on 5GHz |
| 477 | public int num24; // number of BSSIDs on 2.4GHz |
vandwalle | e26bc8f | 2014-09-10 01:32:09 -0700 | [diff] [blame] | 478 | public long age5; // timestamp of the strongest 5GHz BSSID (last time it was seen) |
| 479 | public long age24; // timestamp of the strongest 2.4GHz BSSID (last time it was seen) |
| 480 | public String BSSID24; |
| 481 | public String BSSID5; |
vandwalle | 72e1d3f | 2014-12-15 15:41:34 -0800 | [diff] [blame] | 482 | public int score; // Debug only, indicate last score used for autojoin/cell-handover |
| 483 | public int currentNetworkBoost; // Debug only, indicate boost applied to RSSI if current |
| 484 | public int bandPreferenceBoost; // Debug only, indicate boost applied to RSSI if current |
| 485 | public int lastChoiceBoost; // Debug only, indicate last choice applied to this configuration |
| 486 | public String lastChoiceConfig; // Debug only, indicate last choice applied to this configuration |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 487 | |
| 488 | public Visibility() { |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 489 | rssi5 = INVALID_RSSI; |
| 490 | rssi24 = INVALID_RSSI; |
| 491 | } |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 492 | |
| 493 | public Visibility(Visibility source) { |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 494 | rssi5 = source.rssi5; |
| 495 | rssi24 = source.rssi24; |
| 496 | age24 = source.age24; |
| 497 | age5 = source.age5; |
| 498 | num24 = source.num24; |
| 499 | num5 = source.num5; |
vandwalle | e26bc8f | 2014-09-10 01:32:09 -0700 | [diff] [blame] | 500 | BSSID5 = source.BSSID5; |
| 501 | BSSID24 = source.BSSID24; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 502 | } |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 503 | |
| 504 | @Override |
| 505 | public String toString() { |
| 506 | StringBuilder sbuf = new StringBuilder(); |
| 507 | sbuf.append("["); |
| 508 | if (rssi24 > INVALID_RSSI) { |
| 509 | sbuf.append(Integer.toString(rssi24)); |
| 510 | sbuf.append(","); |
| 511 | sbuf.append(Integer.toString(num24)); |
vandwalle | e26bc8f | 2014-09-10 01:32:09 -0700 | [diff] [blame] | 512 | if (BSSID24 != null) sbuf.append(",").append(BSSID24); |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 513 | } |
vandwalle | 72e1d3f | 2014-12-15 15:41:34 -0800 | [diff] [blame] | 514 | sbuf.append("; "); |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 515 | if (rssi5 > INVALID_RSSI) { |
| 516 | sbuf.append(Integer.toString(rssi5)); |
| 517 | sbuf.append(","); |
| 518 | sbuf.append(Integer.toString(num5)); |
vandwalle | e26bc8f | 2014-09-10 01:32:09 -0700 | [diff] [blame] | 519 | if (BSSID5 != null) sbuf.append(",").append(BSSID5); |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 520 | } |
vandwalle | 72e1d3f | 2014-12-15 15:41:34 -0800 | [diff] [blame] | 521 | if (score != 0) { |
| 522 | sbuf.append("; ").append(score); |
| 523 | sbuf.append(", ").append(currentNetworkBoost); |
| 524 | sbuf.append(", ").append(bandPreferenceBoost); |
| 525 | if (lastChoiceConfig != null) { |
| 526 | sbuf.append(", ").append(lastChoiceBoost); |
| 527 | sbuf.append(", ").append(lastChoiceConfig); |
| 528 | } |
| 529 | } |
vandwalle | 5fb7bf5 | 2014-05-21 15:20:59 -0700 | [diff] [blame] | 530 | sbuf.append("]"); |
| 531 | return sbuf.toString(); |
| 532 | } |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | /** @hide |
| 536 | * Cache the visibility status of this configuration. |
| 537 | * Visibility can change at any time depending on scan results availability. |
| 538 | * Owner of the WifiConfiguration is responsible to set this field based on |
| 539 | * recent scan results. |
| 540 | ***/ |
| 541 | public Visibility visibility; |
| 542 | |
| 543 | /** @hide |
| 544 | * calculate and set Visibility for that configuration. |
| 545 | * |
| 546 | * age in milliseconds: we will consider only ScanResults that are more recent, |
| 547 | * i.e. younger. |
| 548 | ***/ |
Vinit Deshpande | 6f6c781 | 2015-03-27 11:40:17 -0700 | [diff] [blame] | 549 | public void setVisibility(Visibility status) { |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 550 | visibility = status; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 551 | } |
| 552 | |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 553 | // States for the userApproved field |
| 554 | /** |
| 555 | * @hide |
| 556 | * User hasn't specified if connection is okay |
| 557 | */ |
| 558 | public static final int USER_UNSPECIFIED = 0; |
| 559 | /** |
| 560 | * @hide |
| 561 | * User has approved this for connection |
| 562 | */ |
| 563 | public static final int USER_APPROVED = 1; |
| 564 | /** |
| 565 | * @hide |
| 566 | * User has banned this from connection |
| 567 | */ |
| 568 | public static final int USER_BANNED = 2; |
| 569 | /** |
| 570 | * @hide |
| 571 | * Waiting for user input |
| 572 | */ |
| 573 | public static final int USER_PENDING = 3; |
| 574 | |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 575 | /** |
| 576 | * @hide |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 577 | * Number of reports indicating no Internet Access |
| 578 | */ |
| 579 | public int numNoInternetAccessReports; |
| 580 | |
| 581 | /** |
| 582 | * @hide |
Pierre Vandwalle | ced1a65 | 2015-06-16 13:55:44 -0700 | [diff] [blame] | 583 | * For debug: date at which the config was last updated |
| 584 | */ |
| 585 | public String updateTime; |
| 586 | |
| 587 | /** |
| 588 | * @hide |
| 589 | * For debug: date at which the config was last updated |
| 590 | */ |
| 591 | public String creationTime; |
| 592 | |
| 593 | /** |
| 594 | * @hide |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 595 | * The WiFi configuration is considered to have no internet access for purpose of autojoining |
| 596 | * if there has been a report of it having no internet access, and, it never have had |
| 597 | * internet access in the past. |
| 598 | */ |
| 599 | public boolean hasNoInternetAccess() { |
| 600 | return numNoInternetAccessReports > 0 && !validatedInternetAccess; |
| 601 | } |
| 602 | |
| 603 | /** |
Lorenzo Colitti | 1248dd3 | 2015-04-06 17:26:10 +0900 | [diff] [blame] | 604 | * The WiFi configuration is expected not to have Internet access (e.g., a wireless printer, a |
| 605 | * Chromecast hotspot, etc.). This will be set if the user explicitly confirms a connection to |
| 606 | * this configuration and selects "don't ask again". |
| 607 | * @hide |
| 608 | */ |
| 609 | public boolean noInternetAccessExpected; |
| 610 | |
| 611 | /** |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 612 | * @hide |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 613 | * Last time the system was connected to this configuration. |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 614 | */ |
| 615 | public long lastConnected; |
| 616 | |
| 617 | /** |
| 618 | * @hide |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 619 | * Last time the system tried to connect and failed. |
| 620 | */ |
| 621 | public long lastConnectionFailure; |
| 622 | |
| 623 | /** |
| 624 | * @hide |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 625 | * Last time the system tried to roam and failed because of authentication failure or DHCP |
| 626 | * RENEW failure. |
| 627 | */ |
| 628 | public long lastRoamingFailure; |
| 629 | |
| 630 | /** @hide */ |
| 631 | public static int ROAMING_FAILURE_IP_CONFIG = 1; |
| 632 | /** @hide */ |
| 633 | public static int ROAMING_FAILURE_AUTH_FAILURE = 2; |
| 634 | |
| 635 | /** |
| 636 | * @hide |
| 637 | * Initial amount of time this Wifi configuration gets blacklisted for network switching |
| 638 | * because of roaming failure |
| 639 | */ |
| 640 | public long roamingFailureBlackListTimeMilli = 1000; |
| 641 | |
| 642 | /** |
| 643 | * @hide |
| 644 | * Last roaming failure reason code |
| 645 | */ |
| 646 | public int lastRoamingFailureReason; |
| 647 | |
| 648 | /** |
| 649 | * @hide |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 650 | * Last time the system was disconnected to this configuration. |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 651 | */ |
| 652 | public long lastDisconnected; |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 653 | |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 654 | /** |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 655 | * Set if the configuration was self added by the framework |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 656 | * This boolean is cleared if we get a connect/save/ update or |
| 657 | * any wifiManager command that indicate the user interacted with the configuration |
| 658 | * since we will now consider that the configuration belong to him. |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 659 | * @hide |
| 660 | */ |
| 661 | public boolean selfAdded; |
| 662 | |
| 663 | /** |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 664 | * Set if the configuration was self added by the framework |
| 665 | * This boolean is set once and never cleared. It is used |
| 666 | * so as we never loose track of who created the |
| 667 | * configuration in the first place. |
| 668 | * @hide |
| 669 | */ |
| 670 | public boolean didSelfAdd; |
| 671 | |
| 672 | /** |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 673 | * Peer WifiConfiguration this WifiConfiguration was added for |
vandwalle | 2d0f71e | 2014-06-01 14:58:07 -0700 | [diff] [blame] | 674 | * @hide |
| 675 | */ |
| 676 | public String peerWifiConfiguration; |
| 677 | |
| 678 | /** |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 679 | * @hide |
| 680 | * Indicate that a WifiConfiguration is temporary and should not be saved |
| 681 | * nor considered by AutoJoin. |
| 682 | */ |
| 683 | public boolean ephemeral; |
| 684 | |
| 685 | /** |
| 686 | * @hide |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 687 | * A hint about whether or not the network represented by this WifiConfiguration |
| 688 | * is metered. |
| 689 | */ |
| 690 | public boolean meteredHint; |
| 691 | |
| 692 | /** |
| 693 | * @hide |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 694 | * Number of time the scorer overrode a the priority based choice, when comparing two |
| 695 | * WifiConfigurations, note that since comparing WifiConfiguration happens very often |
| 696 | * potentially at every scan, this number might become very large, even on an idle |
| 697 | * system. |
| 698 | */ |
| 699 | @SystemApi |
| 700 | public int numScorerOverride; |
| 701 | |
| 702 | /** |
| 703 | * @hide |
| 704 | * Number of time the scorer overrode a the priority based choice, and the comparison |
| 705 | * triggered a network switch |
| 706 | */ |
| 707 | @SystemApi |
| 708 | public int numScorerOverrideAndSwitchedNetwork; |
| 709 | |
| 710 | /** |
| 711 | * @hide |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 712 | * Number of time we associated to this configuration. |
| 713 | */ |
| 714 | @SystemApi |
| 715 | public int numAssociation; |
| 716 | |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 717 | /** |
| 718 | * @hide |
| 719 | * Number of time user disabled WiFi while associated to this configuration with Low RSSI. |
| 720 | */ |
| 721 | public int numUserTriggeredWifiDisableLowRSSI; |
| 722 | |
| 723 | /** |
| 724 | * @hide |
| 725 | * Number of time user disabled WiFi while associated to this configuration with Bad RSSI. |
| 726 | */ |
| 727 | public int numUserTriggeredWifiDisableBadRSSI; |
| 728 | |
| 729 | /** |
| 730 | * @hide |
| 731 | * Number of time user disabled WiFi while associated to this configuration |
| 732 | * and RSSI was not HIGH. |
| 733 | */ |
| 734 | public int numUserTriggeredWifiDisableNotHighRSSI; |
| 735 | |
| 736 | /** |
| 737 | * @hide |
| 738 | * Number of ticks associated to this configuration with Low RSSI. |
| 739 | */ |
| 740 | public int numTicksAtLowRSSI; |
| 741 | |
| 742 | /** |
| 743 | * @hide |
| 744 | * Number of ticks associated to this configuration with Bad RSSI. |
| 745 | */ |
| 746 | public int numTicksAtBadRSSI; |
| 747 | |
| 748 | /** |
| 749 | * @hide |
| 750 | * Number of ticks associated to this configuration |
| 751 | * and RSSI was not HIGH. |
| 752 | */ |
| 753 | public int numTicksAtNotHighRSSI; |
| 754 | /** |
| 755 | * @hide |
| 756 | * Number of time user (WifiManager) triggered association to this configuration. |
| 757 | * TODO: count this only for Wifi Settings uuid, so as to not count 3rd party apps |
| 758 | */ |
| 759 | public int numUserTriggeredJoinAttempts; |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 760 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 761 | /** @hide |
| 762 | * Boost given to RSSI on a home network for the purpose of calculating the score |
| 763 | * This adds stickiness to home networks, as defined by: |
| 764 | * - less than 4 known BSSIDs |
| 765 | * - PSK only |
| 766 | * - TODO: add a test to verify that all BSSIDs are behind same gateway |
| 767 | ***/ |
| 768 | public static final int HOME_NETWORK_RSSI_BOOST = 5; |
| 769 | |
| 770 | /** |
| 771 | * @hide |
| 772 | * This class is used to contain all the information and API used for quality network selection |
| 773 | */ |
| 774 | public static class NetworkSelectionStatus { |
| 775 | /** |
| 776 | * Quality Network Selection Status enable, temporary disabled, permanently disabled |
| 777 | */ |
| 778 | /** |
| 779 | * This network is allowed to join Quality Network Selection |
| 780 | */ |
| 781 | public static final int NETWORK_SELECTION_ENABLED = 0; |
| 782 | /** |
| 783 | * network was temporary disabled. Can be re-enabled after a time period expire |
| 784 | */ |
| 785 | public static final int NETWORK_SELECTION_TEMPORARY_DISABLED = 1; |
| 786 | /** |
| 787 | * network was permanently disabled. |
| 788 | */ |
| 789 | public static final int NETWORK_SELECTION_PERMANENTLY_DISABLED = 2; |
| 790 | /** |
| 791 | * Maximum Network selection status |
| 792 | */ |
| 793 | public static final int NETWORK_SELECTION_STATUS_MAX = 3; |
| 794 | |
| 795 | /** |
| 796 | * Quality network selection status String (for debug purpose). Use Quality network |
| 797 | * selection status value as index to extec the corresponding debug string |
| 798 | */ |
| 799 | private static final String[] QUALITY_NETWORK_SELECTION_STATUS = { |
xinhe | 90a3841 | 2016-01-20 10:52:50 -0800 | [diff] [blame] | 800 | "NETWORK_SELECTION_ENABLED", |
| 801 | "NETWORK_SELECTION_TEMPORARY_DISABLED", |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 802 | "NETWORK_SELECTION_PERMANENTLY_DISABLED"}; |
| 803 | |
| 804 | //Quality Network disabled reasons |
| 805 | /** |
| 806 | * Default value. Means not disabled |
| 807 | */ |
| 808 | public static final int NETWORK_SELECTION_ENABLE = 0; |
| 809 | /** |
| 810 | * This network is disabled because higher layer (>2) network is bad |
| 811 | */ |
| 812 | public static final int DISABLED_BAD_LINK = 1; |
| 813 | /** |
| 814 | * This network is disabled because multiple association rejects |
| 815 | */ |
| 816 | public static final int DISABLED_ASSOCIATION_REJECTION = 2; |
| 817 | /** |
| 818 | * This network is disabled because multiple authentication failure |
| 819 | */ |
| 820 | public static final int DISABLED_AUTHENTICATION_FAILURE = 3; |
| 821 | /** |
| 822 | * This network is disabled because multiple DHCP failure |
| 823 | */ |
| 824 | public static final int DISABLED_DHCP_FAILURE = 4; |
| 825 | /** |
| 826 | * This network is disabled because of security network but no credentials |
| 827 | */ |
| 828 | public static final int DISABLED_DNS_FAILURE = 5; |
| 829 | /** |
| 830 | * This network is disabled because EAP-TLS failure |
| 831 | */ |
| 832 | public static final int DISABLED_TLS_VERSION_MISMATCH = 6; |
| 833 | /** |
| 834 | * This network is disabled due to WifiManager disable it explicitly |
| 835 | */ |
| 836 | public static final int DISABLED_AUTHENTICATION_NO_CREDENTIALS = 7; |
| 837 | /** |
| 838 | * This network is disabled because no Internet connected and user do not want |
| 839 | */ |
| 840 | public static final int DISABLED_NO_INTERNET = 8; |
| 841 | /** |
| 842 | * This network is disabled due to WifiManager disable it explicitly |
| 843 | */ |
| 844 | public static final int DISABLED_BY_WIFI_MANAGER = 9; |
| 845 | /** |
| 846 | * This Maximum disable reason value |
| 847 | */ |
| 848 | public static final int NETWORK_SELECTION_DISABLED_MAX = 10; |
| 849 | |
| 850 | /** |
| 851 | * Quality network selection disable reason String (for debug purpose) |
| 852 | */ |
| 853 | private static final String[] QUALITY_NETWORK_SELECTION_DISABLE_REASON = { |
xinhe | 90a3841 | 2016-01-20 10:52:50 -0800 | [diff] [blame] | 854 | "NETWORK_SELECTION_ENABLE", |
| 855 | "NETWORK_SELECTION_DISABLED_BAD_LINK", |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 856 | "NETWORK_SELECTION_DISABLED_ASSOCIATION_REJECTION ", |
| 857 | "NETWORK_SELECTION_DISABLED_AUTHENTICATION_FAILURE", |
| 858 | "NETWORK_SELECTION_DISABLED_DHCP_FAILURE", |
xinhe | 90a3841 | 2016-01-20 10:52:50 -0800 | [diff] [blame] | 859 | "NETWORK_SELECTION_DISABLED_DNS_FAILURE", |
| 860 | "NETWORK_SELECTION_DISABLED_TLS_VERSION", |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 861 | "NETWORK_SELECTION_DISABLED_AUTHENTICATION_NO_CREDENTIALS", |
xinhe | 90a3841 | 2016-01-20 10:52:50 -0800 | [diff] [blame] | 862 | "NETWORK_SELECTION_DISABLED_NO_INTERNET", |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 863 | "NETWORK_SELECTION_DISABLED_BY_WIFI_MANAGER"}; |
| 864 | |
| 865 | /** |
| 866 | * Invalid time stamp for network selection disable |
| 867 | */ |
| 868 | public static final long INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP = -1L; |
| 869 | |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 870 | /** |
| 871 | * This constant indicates the current configuration has connect choice set |
| 872 | */ |
| 873 | private static final int CONNECT_CHOICE_EXISTS = 1; |
| 874 | |
| 875 | /** |
| 876 | * This constant indicates the current configuration does not have connect choice set |
| 877 | */ |
| 878 | private static final int CONNECT_CHOICE_NOT_EXISTS = -1; |
| 879 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 880 | // fields for QualityNetwork Selection |
| 881 | /** |
| 882 | * Network selection status, should be in one of three status: enable, temporaily disabled |
| 883 | * or permanently disabled |
| 884 | */ |
| 885 | private int mStatus; |
| 886 | |
| 887 | /** |
| 888 | * Reason for disable this network |
| 889 | */ |
| 890 | private int mNetworkSelectionDisableReason; |
| 891 | |
| 892 | /** |
| 893 | * Last time we temporarily disabled the configuration |
| 894 | */ |
| 895 | private long mTemporarilyDisabledTimestamp = INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP; |
| 896 | |
| 897 | /** |
| 898 | * counter for each Network selection disable reason |
| 899 | */ |
| 900 | private int[] mNetworkSeclectionDisableCounter = new int[NETWORK_SELECTION_DISABLED_MAX]; |
| 901 | |
| 902 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 903 | * Connect Choice over this configuration |
| 904 | * |
| 905 | * When current wifi configuration is visible to the user but user explicitly choose to |
| 906 | * connect to another network X, the another networks X's configure key will be stored here. |
| 907 | * We will consider user has a preference of X over this network. And in the future, |
| 908 | * network selection will always give X a higher preference over this configuration. |
| 909 | * configKey is : "SSID"-WEP-WPA_PSK-WPA_EAP |
| 910 | */ |
| 911 | private String mConnectChoice; |
| 912 | |
| 913 | /** |
| 914 | * The system timestamp when we records the connectChoice. This value is obtained from |
| 915 | * System.currentTimeMillis |
| 916 | */ |
| 917 | private long mConnectChoiceTimestamp = INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP; |
| 918 | |
| 919 | /** |
| 920 | * Used to cache the temporary candidate during the network selection procedure. It will be |
| 921 | * kept updating once a new scan result has a higher score than current one |
| 922 | */ |
| 923 | private ScanResult mCandidate; |
| 924 | |
| 925 | /** |
| 926 | * Used to cache the score of the current temporary candidate during the network |
| 927 | * selection procedure. |
| 928 | */ |
| 929 | private int mCandidateScore; |
| 930 | |
| 931 | /** |
| 932 | * Indicate whether this network is visible in latest Qualified Network Selection. This |
| 933 | * means there is scan result found related to this Configuration and meet the minimum |
| 934 | * requirement. The saved network need not join latest Qualified Network Selection. For |
| 935 | * example, it is disabled. True means network is visible in latest Qualified Network |
| 936 | * Selection and false means network is invisible |
| 937 | */ |
| 938 | private boolean mSeenInLastQualifiedNetworkSelection; |
| 939 | |
| 940 | /** |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 941 | * Boolean indicating if we have ever successfully connected to this network. |
| 942 | * |
| 943 | * This value will be set to true upon a successful connection. |
| 944 | * This value will be set to false if a previous value was not stored in the config or if |
| 945 | * the credentials are updated (ex. a password change). |
| 946 | */ |
| 947 | private boolean mHasEverConnected; |
| 948 | |
| 949 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 950 | * set whether this network is visible in latest Qualified Network Selection |
| 951 | * @param seen value set to candidate |
| 952 | */ |
| 953 | public void setSeenInLastQualifiedNetworkSelection(boolean seen) { |
| 954 | mSeenInLastQualifiedNetworkSelection = seen; |
| 955 | } |
| 956 | |
| 957 | /** |
| 958 | * get whether this network is visible in latest Qualified Network Selection |
| 959 | * @return returns true -- network is visible in latest Qualified Network Selection |
| 960 | * false -- network is invisible in latest Qualified Network Selection |
| 961 | */ |
| 962 | public boolean getSeenInLastQualifiedNetworkSelection() { |
| 963 | return mSeenInLastQualifiedNetworkSelection; |
| 964 | } |
| 965 | /** |
| 966 | * set the temporary candidate of current network selection procedure |
| 967 | * @param scanCandidate {@link ScanResult} the candidate set to mCandidate |
| 968 | */ |
| 969 | public void setCandidate(ScanResult scanCandidate) { |
| 970 | mCandidate = scanCandidate; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * get the temporary candidate of current network selection procedure |
| 975 | * @return returns {@link ScanResult} temporary candidate of current network selection |
| 976 | * procedure |
| 977 | */ |
| 978 | public ScanResult getCandidate() { |
| 979 | return mCandidate; |
| 980 | } |
| 981 | |
| 982 | /** |
| 983 | * set the score of the temporary candidate of current network selection procedure |
| 984 | * @param score value set to mCandidateScore |
| 985 | */ |
| 986 | public void setCandidateScore(int score) { |
| 987 | mCandidateScore = score; |
| 988 | } |
| 989 | |
| 990 | /** |
| 991 | * get the score of the temporary candidate of current network selection procedure |
| 992 | * @return returns score of the temporary candidate of current network selection procedure |
| 993 | */ |
| 994 | public int getCandidateScore() { |
| 995 | return mCandidateScore; |
| 996 | } |
| 997 | |
| 998 | /** |
| 999 | * get user preferred choice over this configuration |
| 1000 | *@return returns configKey of user preferred choice over this configuration |
| 1001 | */ |
| 1002 | public String getConnectChoice() { |
| 1003 | return mConnectChoice; |
| 1004 | } |
| 1005 | |
| 1006 | /** |
| 1007 | * set user preferred choice over this configuration |
| 1008 | * @param newConnectChoice, the configKey of user preferred choice over this configuration |
| 1009 | */ |
| 1010 | public void setConnectChoice(String newConnectChoice) { |
| 1011 | mConnectChoice = newConnectChoice; |
| 1012 | } |
| 1013 | |
| 1014 | /** |
| 1015 | * get the timeStamp when user select a choice over this configuration |
| 1016 | * @return returns when current connectChoice is set (time from System.currentTimeMillis) |
| 1017 | */ |
| 1018 | public long getConnectChoiceTimestamp() { |
| 1019 | return mConnectChoiceTimestamp; |
| 1020 | } |
| 1021 | |
| 1022 | /** |
| 1023 | * set the timeStamp when user select a choice over this configuration |
| 1024 | * @param timeStamp, the timestamp set to connectChoiceTimestamp, expected timestamp should |
| 1025 | * be obtained from System.currentTimeMillis |
| 1026 | */ |
| 1027 | public void setConnectChoiceTimestamp(long timeStamp) { |
| 1028 | mConnectChoiceTimestamp = timeStamp; |
| 1029 | } |
| 1030 | |
| 1031 | /** |
| 1032 | * get current Quality network selection status |
| 1033 | * @return returns current Quality network selection status in String (for debug purpose) |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1034 | */ |
| 1035 | public String getNetworkStatusString() { |
| 1036 | return QUALITY_NETWORK_SELECTION_STATUS[mStatus]; |
| 1037 | } |
| 1038 | |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 1039 | public void setHasEverConnected(boolean value) { |
| 1040 | mHasEverConnected = value; |
| 1041 | } |
| 1042 | |
| 1043 | public boolean getHasEverConnected() { |
| 1044 | return mHasEverConnected; |
| 1045 | } |
| 1046 | |
| 1047 | private NetworkSelectionStatus() { |
| 1048 | // previously stored configs will not have this parameter, so we default to false. |
| 1049 | mHasEverConnected = false; |
| 1050 | }; |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1051 | |
| 1052 | /** |
| 1053 | * @param reason specific error reason |
| 1054 | * @return corresponding network disable reason String (for debug purpose) |
| 1055 | */ |
| 1056 | public static String getNetworkDisableReasonString(int reason) { |
| 1057 | if (reason >= NETWORK_SELECTION_ENABLE && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1058 | return QUALITY_NETWORK_SELECTION_DISABLE_REASON[reason]; |
| 1059 | } else { |
| 1060 | return null; |
| 1061 | } |
| 1062 | } |
| 1063 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1064 | * get current network disable reason |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1065 | * @return current network disable reason in String (for debug purpose) |
| 1066 | */ |
| 1067 | public String getNetworkDisableReasonString() { |
| 1068 | return QUALITY_NETWORK_SELECTION_DISABLE_REASON[mNetworkSelectionDisableReason]; |
| 1069 | } |
| 1070 | |
| 1071 | /** |
| 1072 | * get current network network selection status |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1073 | * @return return current network network selection status |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1074 | */ |
| 1075 | public int getNetworkSelectionStatus() { |
| 1076 | return mStatus; |
| 1077 | } |
| 1078 | /** |
| 1079 | * @return whether current network is enabled to join network selection |
| 1080 | */ |
| 1081 | public boolean isNetworkEnabled() { |
| 1082 | return mStatus == NETWORK_SELECTION_ENABLED; |
| 1083 | } |
| 1084 | |
| 1085 | /** |
| 1086 | * @return whether current network is temporary disabled |
| 1087 | */ |
| 1088 | public boolean isNetworkTemporaryDisabled() { |
| 1089 | return mStatus == NETWORK_SELECTION_TEMPORARY_DISABLED; |
| 1090 | } |
| 1091 | |
| 1092 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1093 | * @return returns whether current network is permanently disabled |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1094 | */ |
| 1095 | public boolean isNetworkPermanentlyDisabled() { |
| 1096 | return mStatus == NETWORK_SELECTION_PERMANENTLY_DISABLED; |
| 1097 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1098 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1099 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1100 | * set current networ work selection status |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1101 | * @param status network selection status to set |
| 1102 | */ |
| 1103 | public void setNetworkSelectionStatus(int status) { |
| 1104 | if (status >= 0 && status < NETWORK_SELECTION_STATUS_MAX) { |
| 1105 | mStatus = status; |
| 1106 | } |
| 1107 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1108 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1109 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1110 | * @return returns current network's disable reason |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1111 | */ |
| 1112 | public int getNetworkSelectionDisableReason() { |
| 1113 | return mNetworkSelectionDisableReason; |
| 1114 | } |
| 1115 | |
| 1116 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1117 | * set Network disable reason |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1118 | * @param reason Network disable reason |
| 1119 | */ |
| 1120 | public void setNetworkSelectionDisableReason(int reason) { |
| 1121 | if (reason >= 0 && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1122 | mNetworkSelectionDisableReason = reason; |
| 1123 | } else { |
| 1124 | throw new IllegalArgumentException("Illegal reason value: " + reason); |
| 1125 | } |
| 1126 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1127 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1128 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1129 | * check whether network is disabled by this reason |
| 1130 | * @param reason a specific disable reason |
| 1131 | * @return true -- network is disabled for this reason |
| 1132 | * false -- network is not disabled for this reason |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1133 | */ |
| 1134 | public boolean isDisabledByReason(int reason) { |
| 1135 | return mNetworkSelectionDisableReason == reason; |
| 1136 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1137 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1138 | /** |
| 1139 | * @param timeStamp Set when current network is disabled in millisecond since January 1, |
| 1140 | * 1970 00:00:00.0 UTC |
| 1141 | */ |
| 1142 | public void setDisableTime(long timeStamp) { |
| 1143 | mTemporarilyDisabledTimestamp = timeStamp; |
| 1144 | } |
| 1145 | |
| 1146 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1147 | * @return returns when current network is disabled in millisecond since January 1, |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1148 | * 1970 00:00:00.0 UTC |
| 1149 | */ |
| 1150 | public long getDisableTime() { |
| 1151 | return mTemporarilyDisabledTimestamp; |
| 1152 | } |
| 1153 | |
| 1154 | /** |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1155 | * get the disable counter of a specific reason |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1156 | * @param reason specific failure reason |
| 1157 | * @exception throw IllegalArgumentException for illegal input |
| 1158 | * @return counter number for specific error reason. |
| 1159 | */ |
| 1160 | public int getDisableReasonCounter(int reason) { |
| 1161 | if (reason >= NETWORK_SELECTION_ENABLE && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1162 | return mNetworkSeclectionDisableCounter[reason]; |
| 1163 | } else { |
| 1164 | throw new IllegalArgumentException("Illegal reason value: " + reason); |
| 1165 | } |
| 1166 | } |
| 1167 | |
| 1168 | /** |
| 1169 | * set the counter of a specific failure reason |
| 1170 | * @param reason reason for disable error |
| 1171 | * @param value the counter value for this specific reason |
| 1172 | * @exception throw IllegalArgumentException for illegal input |
| 1173 | */ |
| 1174 | public void setDisableReasonCounter(int reason, int value) { |
| 1175 | if (reason >= NETWORK_SELECTION_ENABLE && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1176 | mNetworkSeclectionDisableCounter[reason] = value; |
| 1177 | } else { |
| 1178 | throw new IllegalArgumentException("Illegal reason value: " + reason); |
| 1179 | } |
| 1180 | } |
| 1181 | |
| 1182 | /** |
| 1183 | * increment the counter of a specific failure reason |
| 1184 | * @param reason a specific failure reason |
| 1185 | * @exception throw IllegalArgumentException for illegal input |
| 1186 | */ |
| 1187 | public void incrementDisableReasonCounter(int reason) { |
| 1188 | if (reason >= NETWORK_SELECTION_ENABLE && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1189 | mNetworkSeclectionDisableCounter[reason]++; |
| 1190 | } else { |
| 1191 | throw new IllegalArgumentException("Illegal reason value: " + reason); |
| 1192 | } |
| 1193 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1194 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1195 | /** |
| 1196 | * clear the counter of a specific failure reason |
| 1197 | * @hide |
| 1198 | * @param reason a specific failure reason |
| 1199 | * @exception throw IllegalArgumentException for illegal input |
| 1200 | */ |
| 1201 | public void clearDisableReasonCounter(int reason) { |
| 1202 | if (reason >= NETWORK_SELECTION_ENABLE && reason < NETWORK_SELECTION_DISABLED_MAX) { |
| 1203 | mNetworkSeclectionDisableCounter[reason] = NETWORK_SELECTION_ENABLE; |
| 1204 | } else { |
| 1205 | throw new IllegalArgumentException("Illegal reason value: " + reason); |
| 1206 | } |
| 1207 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1208 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1209 | /** |
| 1210 | * clear all the failure reason counters |
| 1211 | */ |
| 1212 | public void clearDisableReasonCounter() { |
| 1213 | Arrays.fill(mNetworkSeclectionDisableCounter, NETWORK_SELECTION_ENABLE); |
| 1214 | } |
| 1215 | |
| 1216 | /** |
| 1217 | * BSSID for connection to this network (through network selection procedure) |
| 1218 | */ |
| 1219 | private String mNetworkSelectionBSSID; |
| 1220 | |
| 1221 | /** |
| 1222 | * get current network Selection BSSID |
| 1223 | * @return current network Selection BSSID |
| 1224 | */ |
| 1225 | public String getNetworkSelectionBSSID() { |
| 1226 | return mNetworkSelectionBSSID; |
| 1227 | } |
| 1228 | |
| 1229 | /** |
| 1230 | * set network Selection BSSID |
| 1231 | * @param bssid The target BSSID for assocaition |
| 1232 | */ |
| 1233 | public void setNetworkSelectionBSSID(String bssid) { |
| 1234 | mNetworkSelectionBSSID = bssid; |
| 1235 | } |
| 1236 | |
| 1237 | public void copy(NetworkSelectionStatus source) { |
| 1238 | mStatus = source.mStatus; |
| 1239 | mNetworkSelectionDisableReason = source.mNetworkSelectionDisableReason; |
| 1240 | for (int index = NETWORK_SELECTION_ENABLE; index < NETWORK_SELECTION_DISABLED_MAX; |
| 1241 | index++) { |
| 1242 | mNetworkSeclectionDisableCounter[index] = |
| 1243 | source.mNetworkSeclectionDisableCounter[index]; |
| 1244 | } |
| 1245 | mTemporarilyDisabledTimestamp = source.mTemporarilyDisabledTimestamp; |
| 1246 | mNetworkSelectionBSSID = source.mNetworkSelectionBSSID; |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1247 | setConnectChoice(source.getConnectChoice()); |
| 1248 | setConnectChoiceTimestamp(source.getConnectChoiceTimestamp()); |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 1249 | setHasEverConnected(source.getHasEverConnected()); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1250 | } |
| 1251 | |
| 1252 | public void writeToParcel(Parcel dest) { |
| 1253 | dest.writeInt(getNetworkSelectionStatus()); |
| 1254 | dest.writeInt(getNetworkSelectionDisableReason()); |
| 1255 | for (int index = NETWORK_SELECTION_ENABLE; index < NETWORK_SELECTION_DISABLED_MAX; |
| 1256 | index++) { |
| 1257 | dest.writeInt(getDisableReasonCounter(index)); |
| 1258 | } |
| 1259 | dest.writeLong(getDisableTime()); |
| 1260 | dest.writeString(getNetworkSelectionBSSID()); |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1261 | if (getConnectChoice() != null) { |
| 1262 | dest.writeInt(CONNECT_CHOICE_EXISTS); |
| 1263 | dest.writeString(getConnectChoice()); |
| 1264 | dest.writeLong(getConnectChoiceTimestamp()); |
| 1265 | } else { |
| 1266 | dest.writeInt(CONNECT_CHOICE_NOT_EXISTS); |
| 1267 | } |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 1268 | dest.writeInt(getHasEverConnected() ? 1 : 0); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1269 | } |
| 1270 | |
| 1271 | public void readFromParcel(Parcel in) { |
| 1272 | setNetworkSelectionStatus(in.readInt()); |
| 1273 | setNetworkSelectionDisableReason(in.readInt()); |
| 1274 | for (int index = NETWORK_SELECTION_ENABLE; index < NETWORK_SELECTION_DISABLED_MAX; |
| 1275 | index++) { |
| 1276 | setDisableReasonCounter(index, in.readInt()); |
| 1277 | } |
| 1278 | setDisableTime(in.readLong()); |
| 1279 | setNetworkSelectionBSSID(in.readString()); |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1280 | if (in.readInt() == CONNECT_CHOICE_EXISTS) { |
| 1281 | setConnectChoice(in.readString()); |
| 1282 | setConnectChoiceTimestamp(in.readLong()); |
| 1283 | } else { |
| 1284 | setConnectChoice(null); |
| 1285 | setConnectChoiceTimestamp(INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP); |
| 1286 | } |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 1287 | setHasEverConnected(in.readInt() != 0); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1288 | } |
| 1289 | } |
| 1290 | |
| 1291 | /** |
| 1292 | * @hide |
| 1293 | * network selection related member |
| 1294 | */ |
| 1295 | private final NetworkSelectionStatus mNetworkSelectionStatus = new NetworkSelectionStatus(); |
| 1296 | |
| 1297 | /** |
| 1298 | * @hide |
| 1299 | * @return network selection status |
| 1300 | */ |
| 1301 | public NetworkSelectionStatus getNetworkSelectionStatus() { |
| 1302 | return mNetworkSelectionStatus; |
| 1303 | } |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1304 | /** |
| 1305 | * @hide |
| 1306 | * Linked Configurations: represent the set of Wificonfigurations that are equivalent |
| 1307 | * regarding roaming and auto-joining. |
| 1308 | * The linked configuration may or may not have same SSID, and may or may not have same |
| 1309 | * credentials. |
| 1310 | * For instance, linked configurations will have same defaultGwMacAddress or same dhcp server. |
| 1311 | */ |
| 1312 | public HashMap<String, Integer> linkedConfigurations; |
| 1313 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1314 | public WifiConfiguration() { |
Irfan Sheriff | 5ee8980 | 2010-09-16 17:53:34 -0700 | [diff] [blame] | 1315 | networkId = INVALID_NETWORK_ID; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1316 | SSID = null; |
| 1317 | BSSID = null; |
Yuhao Zheng | 8a9eb81 | 2014-05-27 10:35:02 -0700 | [diff] [blame] | 1318 | FQDN = null; |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 1319 | roamingConsortiumIds = new long[0]; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1320 | priority = 0; |
| 1321 | hiddenSSID = false; |
| 1322 | allowedKeyManagement = new BitSet(); |
| 1323 | allowedProtocols = new BitSet(); |
| 1324 | allowedAuthAlgorithms = new BitSet(); |
| 1325 | allowedPairwiseCiphers = new BitSet(); |
| 1326 | allowedGroupCiphers = new BitSet(); |
| 1327 | wepKeys = new String[4]; |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1328 | for (int i = 0; i < wepKeys.length; i++) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1329 | wepKeys[i] = null; |
Chung-yih Wang | 4337476 | 2009-09-16 14:28:42 +0800 | [diff] [blame] | 1330 | } |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1331 | enterpriseConfig = new WifiEnterpriseConfig(); |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 1332 | selfAdded = false; |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 1333 | didSelfAdd = false; |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 1334 | ephemeral = false; |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 1335 | meteredHint = false; |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1336 | validatedInternetAccess = false; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1337 | mIpConfiguration = new IpConfiguration(); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1338 | lastUpdateUid = -1; |
| 1339 | creatorUid = -1; |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1340 | shared = true; |
Glen Kuhne | b6cd6fa | 2016-02-10 15:08:33 -0800 | [diff] [blame] | 1341 | dtimInterval = 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1342 | } |
| 1343 | |
Vinit Deshapnde | 10652a9 | 2013-09-09 16:24:36 -0700 | [diff] [blame] | 1344 | /** |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 1345 | * Identify if this configuration represents a passpoint network |
| 1346 | */ |
| 1347 | public boolean isPasspoint() { |
Vinit Deshpande | ad25bb8 | 2015-03-18 17:00:30 -0700 | [diff] [blame] | 1348 | return !TextUtils.isEmpty(FQDN) |
Vinit Deshpande | 2522c83 | 2015-03-12 17:04:35 -0700 | [diff] [blame] | 1349 | && !TextUtils.isEmpty(providerFriendlyName) |
| 1350 | && enterpriseConfig != null |
| 1351 | && enterpriseConfig.getEapMethod() != WifiEnterpriseConfig.Eap.NONE; |
| 1352 | } |
| 1353 | |
| 1354 | /** |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 1355 | * Helper function, identify if a configuration is linked |
| 1356 | * @hide |
| 1357 | */ |
| 1358 | public boolean isLinked(WifiConfiguration config) { |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1359 | if (config != null) { |
| 1360 | if (config.linkedConfigurations != null && linkedConfigurations != null) { |
| 1361 | if (config.linkedConfigurations.get(configKey()) != null |
| 1362 | && linkedConfigurations.get(config.configKey()) != null) { |
| 1363 | return true; |
| 1364 | } |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 1365 | } |
| 1366 | } |
| 1367 | return false; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1368 | } |
| 1369 | |
| 1370 | /** |
Sky Faber | c55cd10 | 2014-09-19 18:21:35 -0700 | [diff] [blame] | 1371 | * Helper function, idenfity if a configuration should be treated as an enterprise network |
| 1372 | * @hide |
| 1373 | */ |
| 1374 | public boolean isEnterprise() { |
| 1375 | return allowedKeyManagement.get(KeyMgmt.WPA_EAP) || |
| 1376 | allowedKeyManagement.get(KeyMgmt.IEEE8021X); |
| 1377 | } |
| 1378 | |
Isaac Levy | 8dc6a1b | 2011-07-27 08:00:03 -0700 | [diff] [blame] | 1379 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1380 | public String toString() { |
Isaac Levy | 8dc6a1b | 2011-07-27 08:00:03 -0700 | [diff] [blame] | 1381 | StringBuilder sbuf = new StringBuilder(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1382 | if (this.status == WifiConfiguration.Status.CURRENT) { |
| 1383 | sbuf.append("* "); |
| 1384 | } else if (this.status == WifiConfiguration.Status.DISABLED) { |
vandwalle | 63edd98 | 2014-10-06 15:04:07 -0700 | [diff] [blame] | 1385 | sbuf.append("- DSBLE "); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1386 | } |
| 1387 | sbuf.append("ID: ").append(this.networkId).append(" SSID: ").append(this.SSID). |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1388 | append(" PROVIDER-NAME: ").append(this.providerFriendlyName). |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1389 | append(" BSSID: ").append(this.BSSID).append(" FQDN: ").append(this.FQDN) |
| 1390 | .append(" PRIO: ").append(this.priority) |
mukesh agrawal | e239938 | 2016-03-02 16:33:33 -0800 | [diff] [blame] | 1391 | .append(" HIDDEN: ").append(this.hiddenSSID) |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1392 | .append('\n'); |
| 1393 | |
| 1394 | |
| 1395 | sbuf.append(" NetworkSelectionStatus ") |
| 1396 | .append(mNetworkSelectionStatus.getNetworkStatusString() + "\n"); |
| 1397 | if (mNetworkSelectionStatus.getNetworkSelectionDisableReason() > 0) { |
| 1398 | sbuf.append(" mNetworkSelectionDisableReason ") |
| 1399 | .append(mNetworkSelectionStatus.getNetworkDisableReasonString() + "\n"); |
| 1400 | |
| 1401 | for (int index = mNetworkSelectionStatus.NETWORK_SELECTION_ENABLE; |
| 1402 | index < mNetworkSelectionStatus.NETWORK_SELECTION_DISABLED_MAX; index++) { |
| 1403 | if (mNetworkSelectionStatus.getDisableReasonCounter(index) != 0) { |
| 1404 | sbuf.append(NetworkSelectionStatus.getNetworkDisableReasonString(index) |
| 1405 | + " counter:" + mNetworkSelectionStatus.getDisableReasonCounter(index) |
| 1406 | + "\n"); |
| 1407 | } |
| 1408 | } |
vandwalle | 16a40cc | 2014-07-28 20:26:58 -0700 | [diff] [blame] | 1409 | } |
xinhe | 584dc6b | 2016-01-26 10:32:03 -0800 | [diff] [blame] | 1410 | if (mNetworkSelectionStatus.getConnectChoice() != null) { |
| 1411 | sbuf.append(" connect choice: ").append(mNetworkSelectionStatus.getConnectChoice()); |
| 1412 | sbuf.append(" connect choice set time: ").append(mNetworkSelectionStatus |
| 1413 | .getConnectChoiceTimestamp()); |
| 1414 | } |
Rebecca Silberstein | cd7167d | 2016-03-25 17:35:58 -0700 | [diff] [blame] | 1415 | sbuf.append(" hasEverConnected: ") |
| 1416 | .append(mNetworkSelectionStatus.getHasEverConnected()).append("\n"); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1417 | |
Mike Lockwood | 0561030 | 2014-09-24 13:51:40 -0700 | [diff] [blame] | 1418 | if (this.numAssociation > 0) { |
| 1419 | sbuf.append(" numAssociation ").append(this.numAssociation).append("\n"); |
vandwalle | 16a40cc | 2014-07-28 20:26:58 -0700 | [diff] [blame] | 1420 | } |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1421 | if (this.numNoInternetAccessReports > 0) { |
| 1422 | sbuf.append(" numNoInternetAccessReports "); |
| 1423 | sbuf.append(this.numNoInternetAccessReports).append("\n"); |
| 1424 | } |
Pierre Vandwalle | ced1a65 | 2015-06-16 13:55:44 -0700 | [diff] [blame] | 1425 | if (this.updateTime != null) { |
Pierre Vandwalle | edbedd2 | 2015-07-01 12:48:26 -0700 | [diff] [blame] | 1426 | sbuf.append("update ").append(this.updateTime).append("\n"); |
Pierre Vandwalle | ced1a65 | 2015-06-16 13:55:44 -0700 | [diff] [blame] | 1427 | } |
| 1428 | if (this.creationTime != null) { |
Pierre Vandwalle | edbedd2 | 2015-07-01 12:48:26 -0700 | [diff] [blame] | 1429 | sbuf.append("creation").append(this.creationTime).append("\n"); |
Pierre Vandwalle | ced1a65 | 2015-06-16 13:55:44 -0700 | [diff] [blame] | 1430 | } |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1431 | if (this.didSelfAdd) sbuf.append(" didSelfAdd"); |
| 1432 | if (this.selfAdded) sbuf.append(" selfAdded"); |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1433 | if (this.validatedInternetAccess) sbuf.append(" validatedInternetAccess"); |
Jeff Davidson | 8faf2a2 | 2014-10-06 16:16:35 -0700 | [diff] [blame] | 1434 | if (this.ephemeral) sbuf.append(" ephemeral"); |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 1435 | if (this.meteredHint) sbuf.append(" meteredHint"); |
| 1436 | if (this.didSelfAdd || this.selfAdded || this.validatedInternetAccess |
| 1437 | || this.ephemeral || this.meteredHint) { |
vandwalle | 16a40cc | 2014-07-28 20:26:58 -0700 | [diff] [blame] | 1438 | sbuf.append("\n"); |
| 1439 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1440 | sbuf.append(" KeyMgmt:"); |
| 1441 | for (int k = 0; k < this.allowedKeyManagement.size(); k++) { |
| 1442 | if (this.allowedKeyManagement.get(k)) { |
| 1443 | sbuf.append(" "); |
| 1444 | if (k < KeyMgmt.strings.length) { |
| 1445 | sbuf.append(KeyMgmt.strings[k]); |
| 1446 | } else { |
| 1447 | sbuf.append("??"); |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | sbuf.append(" Protocols:"); |
| 1452 | for (int p = 0; p < this.allowedProtocols.size(); p++) { |
| 1453 | if (this.allowedProtocols.get(p)) { |
| 1454 | sbuf.append(" "); |
| 1455 | if (p < Protocol.strings.length) { |
| 1456 | sbuf.append(Protocol.strings[p]); |
| 1457 | } else { |
| 1458 | sbuf.append("??"); |
| 1459 | } |
| 1460 | } |
| 1461 | } |
| 1462 | sbuf.append('\n'); |
| 1463 | sbuf.append(" AuthAlgorithms:"); |
| 1464 | for (int a = 0; a < this.allowedAuthAlgorithms.size(); a++) { |
| 1465 | if (this.allowedAuthAlgorithms.get(a)) { |
| 1466 | sbuf.append(" "); |
| 1467 | if (a < AuthAlgorithm.strings.length) { |
| 1468 | sbuf.append(AuthAlgorithm.strings[a]); |
| 1469 | } else { |
| 1470 | sbuf.append("??"); |
| 1471 | } |
| 1472 | } |
| 1473 | } |
| 1474 | sbuf.append('\n'); |
| 1475 | sbuf.append(" PairwiseCiphers:"); |
| 1476 | for (int pc = 0; pc < this.allowedPairwiseCiphers.size(); pc++) { |
| 1477 | if (this.allowedPairwiseCiphers.get(pc)) { |
| 1478 | sbuf.append(" "); |
| 1479 | if (pc < PairwiseCipher.strings.length) { |
| 1480 | sbuf.append(PairwiseCipher.strings[pc]); |
| 1481 | } else { |
| 1482 | sbuf.append("??"); |
| 1483 | } |
| 1484 | } |
| 1485 | } |
| 1486 | sbuf.append('\n'); |
| 1487 | sbuf.append(" GroupCiphers:"); |
| 1488 | for (int gc = 0; gc < this.allowedGroupCiphers.size(); gc++) { |
| 1489 | if (this.allowedGroupCiphers.get(gc)) { |
| 1490 | sbuf.append(" "); |
| 1491 | if (gc < GroupCipher.strings.length) { |
| 1492 | sbuf.append(GroupCipher.strings[gc]); |
| 1493 | } else { |
| 1494 | sbuf.append("??"); |
| 1495 | } |
| 1496 | } |
| 1497 | } |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 1498 | sbuf.append('\n').append(" PSK: "); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1499 | if (this.preSharedKey != null) { |
Chung-yih Wang | 5069cc7 | 2009-06-03 17:33:47 +0800 | [diff] [blame] | 1500 | sbuf.append('*'); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1501 | } |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1502 | sbuf.append("\nEnterprise config:\n"); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1503 | sbuf.append(enterpriseConfig); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1504 | |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1505 | sbuf.append("IP config:\n"); |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1506 | sbuf.append(mIpConfiguration.toString()); |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1507 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1508 | if (mNetworkSelectionStatus.getNetworkSelectionBSSID() != null) { |
| 1509 | sbuf.append(" networkSelectionBSSID=" |
| 1510 | + mNetworkSelectionStatus.getNetworkSelectionBSSID()); |
| 1511 | } |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1512 | long now_ms = System.currentTimeMillis(); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1513 | if (mNetworkSelectionStatus.getDisableTime() != NetworkSelectionStatus |
| 1514 | .INVALID_NETWORK_SELECTION_DISABLE_TIMESTAMP) { |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1515 | sbuf.append('\n'); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1516 | long diff = now_ms - mNetworkSelectionStatus.getDisableTime(); |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 1517 | if (diff <= 0) { |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1518 | sbuf.append(" blackListed since <incorrect>"); |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 1519 | } else { |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1520 | sbuf.append(" blackListed: ").append(Long.toString(diff / 1000)).append("sec "); |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1521 | } |
| 1522 | } |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1523 | if (creatorUid != 0) sbuf.append(" cuid=" + creatorUid); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1524 | if (creatorName != null) sbuf.append(" cname=" + creatorName); |
| 1525 | if (lastUpdateUid != 0) sbuf.append(" luid=" + lastUpdateUid); |
| 1526 | if (lastUpdateName != null) sbuf.append(" lname=" + lastUpdateName); |
Lorenzo Colitti | 1ac50cb | 2015-04-06 17:19:19 +0900 | [diff] [blame] | 1527 | sbuf.append(" lcuid=" + lastConnectUid); |
| 1528 | sbuf.append(" userApproved=" + userApprovedAsString(userApproved)); |
| 1529 | sbuf.append(" noInternetAccessExpected=" + noInternetAccessExpected); |
Lorenzo Colitti | 1248dd3 | 2015-04-06 17:26:10 +0900 | [diff] [blame] | 1530 | sbuf.append(" "); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1531 | |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1532 | if (this.lastConnected != 0) { |
| 1533 | sbuf.append('\n'); |
| 1534 | long diff = now_ms - this.lastConnected; |
| 1535 | if (diff <= 0) { |
| 1536 | sbuf.append("lastConnected since <incorrect>"); |
| 1537 | } else { |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1538 | sbuf.append("lastConnected: ").append(Long.toString(diff / 1000)).append("sec "); |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1539 | } |
| 1540 | } |
| 1541 | if (this.lastConnectionFailure != 0) { |
| 1542 | sbuf.append('\n'); |
| 1543 | long diff = now_ms - this.lastConnectionFailure; |
| 1544 | if (diff <= 0) { |
Pierre Vandwalle | 5ddc65b | 2015-05-20 15:15:31 -0700 | [diff] [blame] | 1545 | sbuf.append("lastConnectionFailure since <incorrect> "); |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1546 | } else { |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1547 | sbuf.append("lastConnectionFailure: ").append(Long.toString(diff / 1000)); |
| 1548 | sbuf.append("sec "); |
vandwalle | 2ab9089 | 2014-06-02 15:30:39 -0700 | [diff] [blame] | 1549 | } |
| 1550 | } |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 1551 | if (this.lastRoamingFailure != 0) { |
| 1552 | sbuf.append('\n'); |
| 1553 | long diff = now_ms - this.lastRoamingFailure; |
| 1554 | if (diff <= 0) { |
Pierre Vandwalle | 5ddc65b | 2015-05-20 15:15:31 -0700 | [diff] [blame] | 1555 | sbuf.append("lastRoamingFailure since <incorrect> "); |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 1556 | } else { |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1557 | sbuf.append("lastRoamingFailure: ").append(Long.toString(diff / 1000)); |
| 1558 | sbuf.append("sec "); |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 1559 | } |
| 1560 | } |
| 1561 | sbuf.append("roamingFailureBlackListTimeMilli: "). |
| 1562 | append(Long.toString(this.roamingFailureBlackListTimeMilli)); |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1563 | sbuf.append('\n'); |
| 1564 | if (this.linkedConfigurations != null) { |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 1565 | for (String key : this.linkedConfigurations.keySet()) { |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1566 | sbuf.append(" linked: ").append(key); |
| 1567 | sbuf.append('\n'); |
| 1568 | } |
| 1569 | } |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1570 | sbuf.append("triggeredLow: ").append(this.numUserTriggeredWifiDisableLowRSSI); |
| 1571 | sbuf.append(" triggeredBad: ").append(this.numUserTriggeredWifiDisableBadRSSI); |
| 1572 | sbuf.append(" triggeredNotHigh: ").append(this.numUserTriggeredWifiDisableNotHighRSSI); |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1573 | sbuf.append('\n'); |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1574 | sbuf.append("ticksLow: ").append(this.numTicksAtLowRSSI); |
| 1575 | sbuf.append(" ticksBad: ").append(this.numTicksAtBadRSSI); |
| 1576 | sbuf.append(" ticksNotHigh: ").append(this.numTicksAtNotHighRSSI); |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1577 | sbuf.append('\n'); |
vandwalle | 94fe7e9 | 2014-09-11 18:41:23 -0700 | [diff] [blame] | 1578 | sbuf.append("triggeredJoin: ").append(this.numUserTriggeredJoinAttempts); |
| 1579 | sbuf.append('\n'); |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 1580 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1581 | return sbuf.toString(); |
| 1582 | } |
| 1583 | |
Irfan Sheriff | b6deeed | 2012-09-05 10:46:24 -0700 | [diff] [blame] | 1584 | /** {@hide} */ |
| 1585 | public String getPrintableSsid() { |
| 1586 | if (SSID == null) return ""; |
| 1587 | final int length = SSID.length(); |
| 1588 | if (length > 2 && (SSID.charAt(0) == '"') && SSID.charAt(length - 1) == '"') { |
| 1589 | return SSID.substring(1, length - 1); |
| 1590 | } |
| 1591 | |
| 1592 | /** The ascii-encoded string format is P"<ascii-encoded-string>" |
| 1593 | * The decoding is implemented in the supplicant for a newly configured |
| 1594 | * network. |
| 1595 | */ |
| 1596 | if (length > 3 && (SSID.charAt(0) == 'P') && (SSID.charAt(1) == '"') && |
| 1597 | (SSID.charAt(length-1) == '"')) { |
| 1598 | WifiSsid wifiSsid = WifiSsid.createFromAsciiEncoded( |
| 1599 | SSID.substring(2, length - 1)); |
| 1600 | return wifiSsid.toString(); |
| 1601 | } |
| 1602 | return SSID; |
| 1603 | } |
| 1604 | |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1605 | /** @hide **/ |
| 1606 | public static String userApprovedAsString(int userApproved) { |
| 1607 | switch (userApproved) { |
| 1608 | case USER_APPROVED: |
| 1609 | return "USER_APPROVED"; |
| 1610 | case USER_BANNED: |
| 1611 | return "USER_BANNED"; |
| 1612 | case USER_UNSPECIFIED: |
| 1613 | return "USER_UNSPECIFIED"; |
| 1614 | default: |
| 1615 | return "INVALID"; |
| 1616 | } |
| 1617 | } |
| 1618 | |
Irfan Sheriff | 26d0076 | 2013-02-05 09:44:12 -0800 | [diff] [blame] | 1619 | /** |
| 1620 | * Get an identifier for associating credentials with this config |
| 1621 | * @param current configuration contains values for additional fields |
| 1622 | * that are not part of this configuration. Used |
| 1623 | * when a config with some fields is passed by an application. |
| 1624 | * @throws IllegalStateException if config is invalid for key id generation |
| 1625 | * @hide |
| 1626 | */ |
Vinit Deshapnde | ffadfb9 | 2013-12-06 15:12:41 -0800 | [diff] [blame] | 1627 | public String getKeyIdForCredentials(WifiConfiguration current) { |
Irfan Sheriff | 26d0076 | 2013-02-05 09:44:12 -0800 | [diff] [blame] | 1628 | String keyMgmt = null; |
| 1629 | |
| 1630 | try { |
| 1631 | // Get current config details for fields that are not initialized |
| 1632 | if (TextUtils.isEmpty(SSID)) SSID = current.SSID; |
| 1633 | if (allowedKeyManagement.cardinality() == 0) { |
| 1634 | allowedKeyManagement = current.allowedKeyManagement; |
| 1635 | } |
| 1636 | if (allowedKeyManagement.get(KeyMgmt.WPA_EAP)) { |
| 1637 | keyMgmt = KeyMgmt.strings[KeyMgmt.WPA_EAP]; |
| 1638 | } |
| 1639 | if (allowedKeyManagement.get(KeyMgmt.IEEE8021X)) { |
| 1640 | keyMgmt += KeyMgmt.strings[KeyMgmt.IEEE8021X]; |
| 1641 | } |
| 1642 | |
| 1643 | if (TextUtils.isEmpty(keyMgmt)) { |
| 1644 | throw new IllegalStateException("Not an EAP network"); |
| 1645 | } |
| 1646 | |
| 1647 | return trimStringForKeyId(SSID) + "_" + keyMgmt + "_" + |
| 1648 | trimStringForKeyId(enterpriseConfig.getKeyId(current != null ? |
| 1649 | current.enterpriseConfig : null)); |
| 1650 | } catch (NullPointerException e) { |
| 1651 | throw new IllegalStateException("Invalid config details"); |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | private String trimStringForKeyId(String string) { |
| 1656 | // Remove quotes and spaces |
| 1657 | return string.replace("\"", "").replace(" ", ""); |
| 1658 | } |
| 1659 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1660 | private static BitSet readBitSet(Parcel src) { |
| 1661 | int cardinality = src.readInt(); |
| 1662 | |
| 1663 | BitSet set = new BitSet(); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1664 | for (int i = 0; i < cardinality; i++) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1665 | set.set(src.readInt()); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1666 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1667 | |
| 1668 | return set; |
| 1669 | } |
| 1670 | |
| 1671 | private static void writeBitSet(Parcel dest, BitSet set) { |
| 1672 | int nextSetBit = -1; |
| 1673 | |
| 1674 | dest.writeInt(set.cardinality()); |
| 1675 | |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1676 | while ((nextSetBit = set.nextSetBit(nextSetBit + 1)) != -1) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1677 | dest.writeInt(nextSetBit); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1678 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1679 | } |
| 1680 | |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 1681 | /** @hide */ |
| 1682 | public int getAuthType() { |
Jan Nordqvist | d492883 | 2015-06-01 16:14:55 -0700 | [diff] [blame] | 1683 | if (allowedKeyManagement.cardinality() > 1) { |
| 1684 | throw new IllegalStateException("More than one auth type set"); |
Irfan Sheriff | 26d0076 | 2013-02-05 09:44:12 -0800 | [diff] [blame] | 1685 | } |
Irfan Sheriff | ec8d23a | 2011-02-16 17:00:33 -0800 | [diff] [blame] | 1686 | if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) { |
| 1687 | return KeyMgmt.WPA_PSK; |
| 1688 | } else if (allowedKeyManagement.get(KeyMgmt.WPA2_PSK)) { |
| 1689 | return KeyMgmt.WPA2_PSK; |
| 1690 | } else if (allowedKeyManagement.get(KeyMgmt.WPA_EAP)) { |
| 1691 | return KeyMgmt.WPA_EAP; |
| 1692 | } else if (allowedKeyManagement.get(KeyMgmt.IEEE8021X)) { |
| 1693 | return KeyMgmt.IEEE8021X; |
| 1694 | } |
| 1695 | return KeyMgmt.NONE; |
| 1696 | } |
| 1697 | |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1698 | /* @hide |
| 1699 | * Cache the config key, this seems useful as a speed up since a lot of |
| 1700 | * lookups in the config store are done and based on this key. |
| 1701 | */ |
| 1702 | String mCachedConfigKey; |
| 1703 | |
| 1704 | /** @hide |
| 1705 | * return the string used to calculate the hash in WifiConfigStore |
| 1706 | * and uniquely identify this WifiConfiguration |
| 1707 | */ |
| 1708 | public String configKey(boolean allowCached) { |
| 1709 | String key; |
| 1710 | if (allowCached && mCachedConfigKey != null) { |
| 1711 | key = mCachedConfigKey; |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1712 | } else if (providerFriendlyName != null) { |
| 1713 | key = FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP]; |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1714 | if (!shared) { |
| 1715 | key += "-" + Integer.toString(UserHandle.getUserId(creatorUid)); |
| 1716 | } |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1717 | } else { |
Lorenzo Colitti | 8e1e34a | 2014-09-30 18:30:04 +0900 | [diff] [blame] | 1718 | if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) { |
| 1719 | key = SSID + KeyMgmt.strings[KeyMgmt.WPA_PSK]; |
| 1720 | } else if (allowedKeyManagement.get(KeyMgmt.WPA_EAP) || |
| 1721 | allowedKeyManagement.get(KeyMgmt.IEEE8021X)) { |
| 1722 | key = SSID + KeyMgmt.strings[KeyMgmt.WPA_EAP]; |
| 1723 | } else if (wepKeys[0] != null) { |
| 1724 | key = SSID + "WEP"; |
| 1725 | } else { |
| 1726 | key = SSID + KeyMgmt.strings[KeyMgmt.NONE]; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1727 | } |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1728 | if (!shared) { |
| 1729 | key += "-" + Integer.toString(UserHandle.getUserId(creatorUid)); |
| 1730 | } |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1731 | mCachedConfigKey = key; |
| 1732 | } |
| 1733 | return key; |
| 1734 | } |
| 1735 | |
| 1736 | /** @hide |
| 1737 | * get configKey, force calculating the config string |
| 1738 | */ |
| 1739 | public String configKey() { |
| 1740 | return configKey(false); |
| 1741 | } |
| 1742 | |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1743 | /** @hide */ |
| 1744 | public IpConfiguration getIpConfiguration() { |
| 1745 | return mIpConfiguration; |
| 1746 | } |
| 1747 | |
| 1748 | /** @hide */ |
| 1749 | public void setIpConfiguration(IpConfiguration ipConfiguration) { |
| 1750 | mIpConfiguration = ipConfiguration; |
| 1751 | } |
| 1752 | |
| 1753 | /** @hide */ |
Lorenzo Colitti | 0a82e80 | 2014-07-31 00:48:01 +0900 | [diff] [blame] | 1754 | public StaticIpConfiguration getStaticIpConfiguration() { |
| 1755 | return mIpConfiguration.getStaticIpConfiguration(); |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1756 | } |
| 1757 | |
| 1758 | /** @hide */ |
Lorenzo Colitti | 0a82e80 | 2014-07-31 00:48:01 +0900 | [diff] [blame] | 1759 | public void setStaticIpConfiguration(StaticIpConfiguration staticIpConfiguration) { |
| 1760 | mIpConfiguration.setStaticIpConfiguration(staticIpConfiguration); |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1761 | } |
| 1762 | |
| 1763 | /** @hide */ |
| 1764 | public IpConfiguration.IpAssignment getIpAssignment() { |
| 1765 | return mIpConfiguration.ipAssignment; |
| 1766 | } |
| 1767 | |
| 1768 | /** @hide */ |
| 1769 | public void setIpAssignment(IpConfiguration.IpAssignment ipAssignment) { |
| 1770 | mIpConfiguration.ipAssignment = ipAssignment; |
| 1771 | } |
| 1772 | |
| 1773 | /** @hide */ |
| 1774 | public IpConfiguration.ProxySettings getProxySettings() { |
| 1775 | return mIpConfiguration.proxySettings; |
| 1776 | } |
| 1777 | |
| 1778 | /** @hide */ |
| 1779 | public void setProxySettings(IpConfiguration.ProxySettings proxySettings) { |
| 1780 | mIpConfiguration.proxySettings = proxySettings; |
| 1781 | } |
| 1782 | |
| 1783 | /** @hide */ |
Lorenzo Colitti | 0a82e80 | 2014-07-31 00:48:01 +0900 | [diff] [blame] | 1784 | public ProxyInfo getHttpProxy() { |
| 1785 | return mIpConfiguration.httpProxy; |
| 1786 | } |
| 1787 | |
| 1788 | /** @hide */ |
| 1789 | public void setHttpProxy(ProxyInfo httpProxy) { |
| 1790 | mIpConfiguration.httpProxy = httpProxy; |
| 1791 | } |
| 1792 | |
| 1793 | /** @hide */ |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1794 | public void setProxy(ProxySettings settings, ProxyInfo proxy) { |
| 1795 | mIpConfiguration.proxySettings = settings; |
Lorenzo Colitti | 0a82e80 | 2014-07-31 00:48:01 +0900 | [diff] [blame] | 1796 | mIpConfiguration.httpProxy = proxy; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1797 | } |
| 1798 | |
vandwalle | 13f48ff | 2014-05-15 14:25:18 -0700 | [diff] [blame] | 1799 | /** Implement the Parcelable interface {@hide} */ |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 1800 | public int describeContents() { |
| 1801 | return 0; |
| 1802 | } |
| 1803 | |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1804 | /** @hide */ |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 1805 | public void setPasspointManagementObjectTree(String passpointManagementObjectTree) { |
| 1806 | mPasspointManagementObjectTree = passpointManagementObjectTree; |
| 1807 | } |
| 1808 | |
| 1809 | /** @hide */ |
| 1810 | public String getMoTree() { |
| 1811 | return mPasspointManagementObjectTree; |
| 1812 | } |
| 1813 | |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1814 | /** copy constructor {@hide} */ |
| 1815 | public WifiConfiguration(WifiConfiguration source) { |
| 1816 | if (source != null) { |
| 1817 | networkId = source.networkId; |
| 1818 | status = source.status; |
| 1819 | SSID = source.SSID; |
| 1820 | BSSID = source.BSSID; |
Yuhao Zheng | 8a9eb81 | 2014-05-27 10:35:02 -0700 | [diff] [blame] | 1821 | FQDN = source.FQDN; |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 1822 | roamingConsortiumIds = source.roamingConsortiumIds.clone(); |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1823 | providerFriendlyName = source.providerFriendlyName; |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1824 | preSharedKey = source.preSharedKey; |
Irfan Sheriff | 9e6222f | 2010-08-23 10:41:11 -0700 | [diff] [blame] | 1825 | |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1826 | mNetworkSelectionStatus.copy(source.getNetworkSelectionStatus()); |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 1827 | apBand = source.apBand; |
| 1828 | apChannel = source.apChannel; |
| 1829 | |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1830 | wepKeys = new String[4]; |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1831 | for (int i = 0; i < wepKeys.length; i++) { |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1832 | wepKeys[i] = source.wepKeys[i]; |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1833 | } |
Irfan Sheriff | 9e6222f | 2010-08-23 10:41:11 -0700 | [diff] [blame] | 1834 | |
Irfan Sheriff | 128ceca | 2010-09-22 16:09:46 -0700 | [diff] [blame] | 1835 | wepTxKeyIndex = source.wepTxKeyIndex; |
| 1836 | priority = source.priority; |
| 1837 | hiddenSSID = source.hiddenSSID; |
| 1838 | allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone(); |
| 1839 | allowedProtocols = (BitSet) source.allowedProtocols.clone(); |
| 1840 | allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone(); |
| 1841 | allowedPairwiseCiphers = (BitSet) source.allowedPairwiseCiphers.clone(); |
| 1842 | allowedGroupCiphers = (BitSet) source.allowedGroupCiphers.clone(); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1843 | enterpriseConfig = new WifiEnterpriseConfig(source.enterpriseConfig); |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 1844 | |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1845 | defaultGwMacAddress = source.defaultGwMacAddress; |
| 1846 | |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1847 | mIpConfiguration = new IpConfiguration(source.mIpConfiguration); |
| 1848 | |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1849 | if ((source.linkedConfigurations != null) |
| 1850 | && (source.linkedConfigurations.size() > 0)) { |
| 1851 | linkedConfigurations = new HashMap<String, Integer>(); |
| 1852 | linkedConfigurations.putAll(source.linkedConfigurations); |
| 1853 | } |
| 1854 | mCachedConfigKey = null; //force null configKey |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 1855 | selfAdded = source.selfAdded; |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1856 | validatedInternetAccess = source.validatedInternetAccess; |
Jeff Davidson | 8faf2a2 | 2014-10-06 16:16:35 -0700 | [diff] [blame] | 1857 | ephemeral = source.ephemeral; |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 1858 | meteredHint = source.meteredHint; |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1859 | if (source.visibility != null) { |
| 1860 | visibility = new Visibility(source.visibility); |
| 1861 | } |
vandwalle | 3a74e2ef | 2014-05-21 21:21:00 -0700 | [diff] [blame] | 1862 | |
| 1863 | lastFailure = source.lastFailure; |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 1864 | didSelfAdd = source.didSelfAdd; |
| 1865 | lastConnectUid = source.lastConnectUid; |
| 1866 | lastUpdateUid = source.lastUpdateUid; |
| 1867 | creatorUid = source.creatorUid; |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1868 | creatorName = source.creatorName; |
| 1869 | lastUpdateName = source.lastUpdateName; |
vandwalle | 2d0f71e | 2014-06-01 14:58:07 -0700 | [diff] [blame] | 1870 | peerWifiConfiguration = source.peerWifiConfiguration; |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1871 | |
vandwalle | 111fa02 | 2014-06-10 20:47:58 -0700 | [diff] [blame] | 1872 | lastConnected = source.lastConnected; |
| 1873 | lastDisconnected = source.lastDisconnected; |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 1874 | lastConnectionFailure = source.lastConnectionFailure; |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 1875 | lastRoamingFailure = source.lastRoamingFailure; |
| 1876 | lastRoamingFailureReason = source.lastRoamingFailureReason; |
| 1877 | roamingFailureBlackListTimeMilli = source.roamingFailureBlackListTimeMilli; |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 1878 | numScorerOverride = source.numScorerOverride; |
| 1879 | numScorerOverrideAndSwitchedNetwork = source.numScorerOverrideAndSwitchedNetwork; |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 1880 | numAssociation = source.numAssociation; |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1881 | numUserTriggeredWifiDisableLowRSSI = source.numUserTriggeredWifiDisableLowRSSI; |
| 1882 | numUserTriggeredWifiDisableBadRSSI = source.numUserTriggeredWifiDisableBadRSSI; |
| 1883 | numUserTriggeredWifiDisableNotHighRSSI = source.numUserTriggeredWifiDisableNotHighRSSI; |
| 1884 | numTicksAtLowRSSI = source.numTicksAtLowRSSI; |
| 1885 | numTicksAtBadRSSI = source.numTicksAtBadRSSI; |
| 1886 | numTicksAtNotHighRSSI = source.numTicksAtNotHighRSSI; |
| 1887 | numUserTriggeredJoinAttempts = source.numUserTriggeredJoinAttempts; |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1888 | userApproved = source.userApproved; |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1889 | numNoInternetAccessReports = source.numNoInternetAccessReports; |
Lorenzo Colitti | 1248dd3 | 2015-04-06 17:26:10 +0900 | [diff] [blame] | 1890 | noInternetAccessExpected = source.noInternetAccessExpected; |
Pierre Vandwalle | ced1a65 | 2015-06-16 13:55:44 -0700 | [diff] [blame] | 1891 | creationTime = source.creationTime; |
| 1892 | updateTime = source.updateTime; |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1893 | shared = source.shared; |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1894 | } |
Irfan Sheriff | 9e6222f | 2010-08-23 10:41:11 -0700 | [diff] [blame] | 1895 | } |
| 1896 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1897 | /** Implement the Parcelable interface {@hide} */ |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1898 | @Override |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1899 | public void writeToParcel(Parcel dest, int flags) { |
| 1900 | dest.writeInt(networkId); |
| 1901 | dest.writeInt(status); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1902 | mNetworkSelectionStatus.writeToParcel(dest); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1903 | dest.writeString(SSID); |
| 1904 | dest.writeString(BSSID); |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 1905 | dest.writeInt(apBand); |
| 1906 | dest.writeInt(apChannel); |
Yuhao Zheng | 8a9eb81 | 2014-05-27 10:35:02 -0700 | [diff] [blame] | 1907 | dest.writeString(FQDN); |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1908 | dest.writeString(providerFriendlyName); |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 1909 | dest.writeInt(roamingConsortiumIds.length); |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 1910 | for (long roamingConsortiumId : roamingConsortiumIds) { |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1911 | dest.writeLong(roamingConsortiumId); |
| 1912 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1913 | dest.writeString(preSharedKey); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1914 | for (String wepKey : wepKeys) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1915 | dest.writeString(wepKey); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1916 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1917 | dest.writeInt(wepTxKeyIndex); |
| 1918 | dest.writeInt(priority); |
| 1919 | dest.writeInt(hiddenSSID ? 1 : 0); |
Yuhao Zheng | 5f9385f | 2014-06-30 15:32:08 -0700 | [diff] [blame] | 1920 | dest.writeInt(requirePMF ? 1 : 0); |
| 1921 | dest.writeString(updateIdentifier); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1922 | |
| 1923 | writeBitSet(dest, allowedKeyManagement); |
| 1924 | writeBitSet(dest, allowedProtocols); |
| 1925 | writeBitSet(dest, allowedAuthAlgorithms); |
| 1926 | writeBitSet(dest, allowedPairwiseCiphers); |
| 1927 | writeBitSet(dest, allowedGroupCiphers); |
Chung-yih Wang | 4337476 | 2009-09-16 14:28:42 +0800 | [diff] [blame] | 1928 | |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1929 | dest.writeParcelable(enterpriseConfig, flags); |
Jaewan Kim | 6789797 | 2014-04-07 09:01:24 +0000 | [diff] [blame] | 1930 | |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 1931 | dest.writeParcelable(mIpConfiguration, flags); |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 1932 | dest.writeString(dhcpServer); |
| 1933 | dest.writeString(defaultGwMacAddress); |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 1934 | dest.writeInt(selfAdded ? 1 : 0); |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 1935 | dest.writeInt(didSelfAdd ? 1 : 0); |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1936 | dest.writeInt(validatedInternetAccess ? 1 : 0); |
Jeff Davidson | 8faf2a2 | 2014-10-06 16:16:35 -0700 | [diff] [blame] | 1937 | dest.writeInt(ephemeral ? 1 : 0); |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 1938 | dest.writeInt(meteredHint ? 1 : 0); |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 1939 | dest.writeInt(creatorUid); |
| 1940 | dest.writeInt(lastConnectUid); |
| 1941 | dest.writeInt(lastUpdateUid); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1942 | dest.writeString(creatorName); |
| 1943 | dest.writeString(lastUpdateName); |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 1944 | dest.writeLong(lastConnectionFailure); |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 1945 | dest.writeLong(lastRoamingFailure); |
| 1946 | dest.writeInt(lastRoamingFailureReason); |
| 1947 | dest.writeLong(roamingFailureBlackListTimeMilli); |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 1948 | dest.writeInt(numScorerOverride); |
| 1949 | dest.writeInt(numScorerOverrideAndSwitchedNetwork); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 1950 | dest.writeInt(numAssociation); |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 1951 | dest.writeInt(numUserTriggeredWifiDisableLowRSSI); |
| 1952 | dest.writeInt(numUserTriggeredWifiDisableBadRSSI); |
| 1953 | dest.writeInt(numUserTriggeredWifiDisableNotHighRSSI); |
| 1954 | dest.writeInt(numTicksAtLowRSSI); |
| 1955 | dest.writeInt(numTicksAtBadRSSI); |
| 1956 | dest.writeInt(numTicksAtNotHighRSSI); |
| 1957 | dest.writeInt(numUserTriggeredJoinAttempts); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 1958 | dest.writeInt(userApproved); |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 1959 | dest.writeInt(numNoInternetAccessReports); |
Lorenzo Colitti | 1248dd3 | 2015-04-06 17:26:10 +0900 | [diff] [blame] | 1960 | dest.writeInt(noInternetAccessExpected ? 1 : 0); |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 1961 | dest.writeInt(shared ? 1 : 0); |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 1962 | dest.writeString(mPasspointManagementObjectTree); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1963 | } |
| 1964 | |
| 1965 | /** Implement the Parcelable interface {@hide} */ |
| 1966 | public static final Creator<WifiConfiguration> CREATOR = |
| 1967 | new Creator<WifiConfiguration>() { |
| 1968 | public WifiConfiguration createFromParcel(Parcel in) { |
| 1969 | WifiConfiguration config = new WifiConfiguration(); |
| 1970 | config.networkId = in.readInt(); |
| 1971 | config.status = in.readInt(); |
xinhe | 8d10678 | 2015-12-01 14:44:37 -0800 | [diff] [blame] | 1972 | config.mNetworkSelectionStatus.readFromParcel(in); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1973 | config.SSID = in.readString(); |
| 1974 | config.BSSID = in.readString(); |
xinhe | a0be0fb | 2015-01-07 17:57:38 -0800 | [diff] [blame] | 1975 | config.apBand = in.readInt(); |
| 1976 | config.apChannel = in.readInt(); |
Yuhao Zheng | 8a9eb81 | 2014-05-27 10:35:02 -0700 | [diff] [blame] | 1977 | config.FQDN = in.readString(); |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1978 | config.providerFriendlyName = in.readString(); |
| 1979 | int numRoamingConsortiumIds = in.readInt(); |
Vinit Deshpande | 7226c8f | 2015-06-30 13:43:02 -0700 | [diff] [blame] | 1980 | config.roamingConsortiumIds = new long[numRoamingConsortiumIds]; |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1981 | for (int i = 0; i < numRoamingConsortiumIds; i++) { |
Vinit Deshpande | a0d929e | 2015-06-12 15:18:44 -0700 | [diff] [blame] | 1982 | config.roamingConsortiumIds[i] = in.readLong(); |
Vinit Deshpande | b21d248 | 2015-02-02 10:50:36 -0800 | [diff] [blame] | 1983 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1984 | config.preSharedKey = in.readString(); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1985 | for (int i = 0; i < config.wepKeys.length; i++) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1986 | config.wepKeys[i] = in.readString(); |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 1987 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1988 | config.wepTxKeyIndex = in.readInt(); |
| 1989 | config.priority = in.readInt(); |
| 1990 | config.hiddenSSID = in.readInt() != 0; |
Yuhao Zheng | 5f9385f | 2014-06-30 15:32:08 -0700 | [diff] [blame] | 1991 | config.requirePMF = in.readInt() != 0; |
| 1992 | config.updateIdentifier = in.readString(); |
| 1993 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1994 | config.allowedKeyManagement = readBitSet(in); |
| 1995 | config.allowedProtocols = readBitSet(in); |
| 1996 | config.allowedAuthAlgorithms = readBitSet(in); |
| 1997 | config.allowedPairwiseCiphers = readBitSet(in); |
| 1998 | config.allowedGroupCiphers = readBitSet(in); |
Chung-yih Wang | 4337476 | 2009-09-16 14:28:42 +0800 | [diff] [blame] | 1999 | |
Irfan Sheriff | 9b81319 | 2013-01-11 14:03:55 -0800 | [diff] [blame] | 2000 | config.enterpriseConfig = in.readParcelable(null); |
Jaewan Kim | 6346155 | 2014-03-10 17:10:51 +0900 | [diff] [blame] | 2001 | config.mIpConfiguration = in.readParcelable(null); |
vandwalle | 7c3606c | 2014-03-31 19:12:07 -0700 | [diff] [blame] | 2002 | config.dhcpServer = in.readString(); |
| 2003 | config.defaultGwMacAddress = in.readString(); |
vandwalle | e50869d | 2014-05-13 13:08:44 -0700 | [diff] [blame] | 2004 | config.selfAdded = in.readInt() != 0; |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 2005 | config.didSelfAdd = in.readInt() != 0; |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 2006 | config.validatedInternetAccess = in.readInt() != 0; |
Jeff Davidson | 8faf2a2 | 2014-10-06 16:16:35 -0700 | [diff] [blame] | 2007 | config.ephemeral = in.readInt() != 0; |
Jeremy Joslin | f0c9b8c | 2016-03-17 10:10:32 -0700 | [diff] [blame] | 2008 | config.meteredHint = in.readInt() != 0; |
vandwalle | 8f13548 | 2014-05-30 14:29:49 -0700 | [diff] [blame] | 2009 | config.creatorUid = in.readInt(); |
| 2010 | config.lastConnectUid = in.readInt(); |
| 2011 | config.lastUpdateUid = in.readInt(); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 2012 | config.creatorName = in.readString(); |
| 2013 | config.lastUpdateName = in.readString(); |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 2014 | config.lastConnectionFailure = in.readLong(); |
vandwalle | 8650c03 | 2015-01-11 11:57:01 -0800 | [diff] [blame] | 2015 | config.lastRoamingFailure = in.readLong(); |
| 2016 | config.lastRoamingFailureReason = in.readInt(); |
| 2017 | config.roamingFailureBlackListTimeMilli = in.readLong(); |
vandwalle | 154b2cf | 2014-07-23 16:03:43 -0700 | [diff] [blame] | 2018 | config.numScorerOverride = in.readInt(); |
| 2019 | config.numScorerOverrideAndSwitchedNetwork = in.readInt(); |
vandwalle | 4eeecb2 | 2014-07-25 17:10:56 -0700 | [diff] [blame] | 2020 | config.numAssociation = in.readInt(); |
vandwalle | 448e208 | 2014-09-05 00:01:24 -0700 | [diff] [blame] | 2021 | config.numUserTriggeredWifiDisableLowRSSI = in.readInt(); |
| 2022 | config.numUserTriggeredWifiDisableBadRSSI = in.readInt(); |
| 2023 | config.numUserTriggeredWifiDisableNotHighRSSI = in.readInt(); |
| 2024 | config.numTicksAtLowRSSI = in.readInt(); |
| 2025 | config.numTicksAtBadRSSI = in.readInt(); |
| 2026 | config.numTicksAtNotHighRSSI = in.readInt(); |
| 2027 | config.numUserTriggeredJoinAttempts = in.readInt(); |
Sky Faber | 3e3857c | 2014-09-22 13:54:18 -0700 | [diff] [blame] | 2028 | config.userApproved = in.readInt(); |
vandwalle | ec3e980 | 2014-11-07 17:29:24 -0800 | [diff] [blame] | 2029 | config.numNoInternetAccessReports = in.readInt(); |
Lorenzo Colitti | 1248dd3 | 2015-04-06 17:26:10 +0900 | [diff] [blame] | 2030 | config.noInternetAccessExpected = in.readInt() != 0; |
Bartosz Fabianowski | 6fb0756 | 2016-01-12 15:43:19 +0100 | [diff] [blame] | 2031 | config.shared = in.readInt() != 0; |
Vinit Deshpande | a772f0c | 2016-01-27 19:05:24 -0800 | [diff] [blame] | 2032 | config.mPasspointManagementObjectTree = in.readString(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2033 | return config; |
| 2034 | } |
| 2035 | |
| 2036 | public WifiConfiguration[] newArray(int size) { |
| 2037 | return new WifiConfiguration[size]; |
| 2038 | } |
| 2039 | }; |
Ritesh Reddy | aeb4c06 | 2016-01-26 19:40:48 +0000 | [diff] [blame] | 2040 | |
| 2041 | /** |
| 2042 | * Serializes the object for backup |
| 2043 | * @hide |
| 2044 | */ |
| 2045 | public byte[] getBytesForBackup() throws IOException { |
| 2046 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 2047 | DataOutputStream out = new DataOutputStream(baos); |
| 2048 | |
| 2049 | out.writeInt(BACKUP_VERSION); |
| 2050 | BackupUtils.writeString(out, SSID); |
| 2051 | out.writeInt(apBand); |
| 2052 | out.writeInt(apChannel); |
| 2053 | BackupUtils.writeString(out, preSharedKey); |
| 2054 | out.writeInt(getAuthType()); |
| 2055 | return baos.toByteArray(); |
| 2056 | } |
| 2057 | |
| 2058 | /** |
| 2059 | * Deserializes a byte array into the WiFiConfiguration Object |
| 2060 | * @hide |
| 2061 | */ |
| 2062 | public static WifiConfiguration getWifiConfigFromBackup(DataInputStream in) throws IOException, |
| 2063 | BackupUtils.BadVersionException { |
| 2064 | WifiConfiguration config = new WifiConfiguration(); |
| 2065 | int version = in.readInt(); |
| 2066 | if (version < 1 || version > BACKUP_VERSION) { |
| 2067 | throw new BackupUtils.BadVersionException("Unknown Backup Serialization Version"); |
| 2068 | } |
| 2069 | |
| 2070 | if (version == 1) return null; // Version 1 is a bad dataset. |
| 2071 | |
| 2072 | config.SSID = BackupUtils.readString(in); |
| 2073 | config.apBand = in.readInt(); |
| 2074 | config.apChannel = in.readInt(); |
| 2075 | config.preSharedKey = BackupUtils.readString(in); |
| 2076 | config.allowedKeyManagement.set(in.readInt()); |
| 2077 | return config; |
| 2078 | } |
Glen Kuhne | b6cd6fa | 2016-02-10 15:08:33 -0800 | [diff] [blame] | 2079 | } |