768 Commits

Author SHA1 Message Date
Vinit Deshapnde
8fa06ee413 Increase Reject threshold for disabling networks
This change modifies a framework optimization. The framework optimization
disables a network when an access point repeatedly rejects requests
to associate with it. This change has some problems; one being that
it counts the rejects for all networks, and not for a specific network.
This incorrectly penalizes last networks at times; and since the current
threshold is 4 rejects, the probability of penalizing wrong networks
is high. This change ups that number to 16 to reduce that probability.

Bug: 11654725

Change-Id: I7150a9ccbb54bac44f2c2ba100fb6617ded33616
2013-11-13 15:48:11 -08:00
Robert Greenwalt
a029ea1318 Add BatteryStats for Wifi Batched Scanning.
bug:10690989
Change-Id: Ia39b715ee6d5733970095bc76de0ed40ff8208c0
2013-11-06 17:43:18 -08:00
Vinit Deshapnde
da40d92766 Don't set same country code on supplicant again and again
Setting the same code is redundant, and may cause supplicant to drop
currently connected connection.

Bug: 11303252
Change-Id: I1af57b3af2d0b8cc51939a8b9872fb3fe0105a91
2013-10-21 17:55:12 -07:00
Robert Greenwalt
c95d938168 Make Wifi Scans more heap-efficient
We were ending up with 1 reference to every char array
in which a new AP was discovered.  In a busy env this could
cost several hundred K from the dalvik heap.

bug:11087956
Change-Id: I3b14c39fd0c98e4aea08a406e80bcf6af40d0664
2013-10-11 14:18:26 -07:00
Yuhao Zheng
3309bc5f24 Merge "WifiStateMachine: fix for exiting L2ConnectedState" into klp-dev 2013-10-10 16:18:59 +00:00
Robert Greenwalt
8d9167ded3 Narrow previous fix for this issue.
Networks should be unconditionally disabled when going to
scan only state or we risk connecting when we don't want to.

bug:11062188
Change-Id: If89621ca07d86673a661d2e5fe4ce89286f8835e
2013-10-09 16:31:35 -07:00
Robert Greenwalt
15af21252d Don't mark wifi disabled unless it's off.
The transition from driver-started to scan-only state was incorrectly
always marking wifi disabled, but transitioning back only marked it
enabled if we were exiting due to leaving the scan-only-with-wifi-off
mode.

bug:11062188
Change-Id: I44fe64fd8dac8f36f4e22cb1c16b9d7a06bdbac0
2013-10-09 12:48:07 -07:00
Yuhao Zheng
a9e6be83ae WifiStateMachine: fix for exiting L2ConnectedState
After a L2ConnectedState to WpsRunningState transition, network is disconnected.
However, the disconnected message is ignored by WpsRunningState, leaving DHCP
still running. When entering L2ConnectedState again, WifiStateMachine gets stuck
on waiting for DhcpStateMachine, because DHCP is already running and the command
CMD_START_DHCP is ignored. Calling handleNetworkDisconnect() when exiting
L2ConnectedState fixes this problem, plus it handles disconnection correctly.

Bug: 10900241
Change-Id: Id29e4989b29db7e64719940cf93eba1f1a90912a
2013-10-08 18:16:03 -07:00
Robert Greenwalt
cac2fd302e Merge "Revert "Use a build-specific wifi country code"" into klp-dev 2013-10-04 18:33:51 +00:00
Robert Greenwalt
cb2fe96f2c Un-deprecate getDhcpInfo
Replacement api isn't available.

bug:10003785
Change-Id: Ibe981ae90e1c6c2f1b65fa225443ae4cc92c2a3a
2013-10-04 09:53:39 -07:00
Vinit Deshapnde
3eb6e4b4e4 Merge "Fix EAP-TLS reconnect after reboot issue" into klp-dev 2013-10-03 21:19:52 +00:00
Robert Greenwalt
3ea0c99b67 Revert "Use a build-specific wifi country code"
This reverts commit c33cd23c17c24df33550a6662cedfe60b323604a.

bug:11064682
Change-Id: I35825a7005e75f3abf02f23f31dee1cb7b101c31
2013-10-03 21:15:54 +00:00
Vinit Deshapnde
a3038b2b31 Fix EAP-TLS reconnect after reboot issue
After a reboot, KeyStore is locked, and certificates encrypted with user
PIN are not accessible. So statemachines are not able to connect to
EAP-TLS networks. This change makes the problem less severe by

1. Not signing certificates with user PIN on devices with hardware backed
KeyStore.
2. Issuing a reconnect upon first USER_PRESENT event.

This means HH (which has a hardware backed keystore) can connect to
EAP-TLS networks without requiring user intervention and other devices
will automatically connect to those networks after user punches PIN.

Bug: 10325089

Change-Id: I023d60e58d8214152f051bd9ec84b85b702d829a
2013-10-02 17:26:05 -07:00
Robert Greenwalt
c33cd23c17 Use a build-specific wifi country code
This ignores any previous setting and instead uses
a value set at build time.  This does not preclude
us from using some other signal to determine country
for wifi channel limits.

bug:10513734
Change-Id: Ib82c07285af70fbd82eb0466b7391979ebc8be10
2013-09-29 15:45:47 -07:00
Vinit Deshapnde
6029611e3a Fix an incorrectly created race accessing Wifi Supplicant
ScanModeState is trying to undo whatever it did in its enter(), in its
exit() function. But doing that is incorrect because it is possible to
transition to multiple states that require different conditions.

In this bug, the state machine transitioned from ScanModeState to
WaitForP2pDisabled state; in response to Stop Supplicant command. Well,
when we are trying to stop supplicant, there is clearly no need to
enable P2P or load all networks. But since this code exists in exit(),
it is executed nonetheless, causing race conditions accessing the
wpa_supplicant (WifiStateMachine is trying to shut it down, but
P2pStateMachine is trying to bring up the p2p interfaces).

We solve that problem by moving this code to the place where we transition
to DisconnectedState - since that's the state that needs this as a
precondition.

Bug: 10761752
Change-Id: Iaf0ffd8056de8533b5d2bfdf8c440fbb7e406dac
2013-09-24 17:38:09 -07:00
Vinit Deshapnde
662c326e5f Merge "Allow yet another combination of key management options" into klp-dev 2013-09-23 17:46:00 +00:00
Robert Greenwalt
0983eadff2 Merge "Fix BatchScan request coalesing" into klp-dev 2013-09-22 15:59:01 +00:00
Robert Greenwalt
13820af302 Fix BatchScan request coalesing
bug:10407896
Change-Id: Ic22c7d8b2a80d490d208570782a12e42d4690f5c
2013-09-20 15:30:17 -07:00
Vinit Deshapnde
2871588101 Allow yet another combination of key management options
Framework sets allowedKeyManagement to WPA_EAP + WPA_PSK, if
WifiConfiguration didn't supply any value for it. It should probably
change to NONE; but that is post K thing. I am allowing that
combination for now.

Bug: 10843500
Change-Id: Id0c28f4aaf32c6a7e7dca07114a2452ce194a798
2013-09-20 15:21:33 -07:00
David Christie
f31a789774 Merge "Clear names from externally supplied WorkSources to WifiManager (b/10733757)" into klp-dev 2013-09-20 20:04:04 +00:00
Vinit Deshapnde
a5fb120438 Merge "Fix incorrect exception being thrown from WifiConfiguration" into klp-dev 2013-09-20 19:30:26 +00:00
David Christie
a31510e47a Clear names from externally supplied WorkSources to WifiManager (b/10733757)
Change-Id: I36102f13962df2093c1e35fb40081ead647eff32
2013-09-20 11:41:41 -07:00
Robert Greenwalt
c237c20441 Merge "Supsend/resume batched scans around dhcp." into klp-dev 2013-09-20 17:55:44 +00:00
Robert Greenwalt
540784f903 Merge "Cleanup the shutdown of BatchedScans." into klp-dev 2013-09-20 17:43:30 +00:00
Robert Greenwalt
81fec6be04 Supsend/resume batched scans around dhcp.
Scanning while dhcp is running breaks dhcp, so stop the batched scans
when we need dhcp and start it up again after.

bug:10691401
Change-Id: Ifdeb6f35cfe4509b90fed1e1e694d0c107f24a7e
2013-09-20 10:13:46 -07:00
Vinit Deshapnde
0fd3b1be14 Fix incorrect exception being thrown from WifiConfiguration
Bug: 10817189

Change-Id: Ib2985f50080cb9d983a6de6ce668223e8782c3b6
2013-09-20 10:12:30 -07:00
Robert Greenwalt
82f4218c0d Cleanup the shutdown of BatchedScans.
Fixes binder-death as well as disambiguation when an app has multiple requests in.

bug:10641931
Change-Id: Ib701d531fa51e7e2a027848cfdfcad3b47056923
2013-09-20 16:32:47 +00:00
Yuhao Zheng
fffc5a4ec9 Remove STOPSHIP in WifiWatchdogStateMachine
There used to be some STOPSHIP code in WifiWatchdogStateMachine for debug
purposes. We don't need them for the release.

Bug: 10841961
Change-Id: I501d62e9891ace52317e6c1d399b877175099a3c
2013-09-19 14:02:58 -07:00
Vinit Deshapnde
3b25f51609 Consider current EAP TLS configurations as 'valid'
Multiple authentication methods are currently considered invalid; but
WPA_EAP and IEEE8021X are set simultaneously. This means we need to
fix code to consider them a valid combination.

Bug: 10325089

Change-Id: I2b4f4d75f21df78bfca66a930e85214c0cd6922e
2013-09-16 15:09:21 -07:00
Robert Greenwalt
14e5599672 Merge "Fix Batched Scan Results to give Timestamp in uS" into klp-dev 2013-09-13 00:04:30 +00:00
Stephen Hines
cbaf152588 Fix build break with missing VDBG.
Change-Id: Iaf64cf49300a6a0a91374efa3030d6894367c9b8
2013-09-12 16:16:00 -07:00
Vinit Deshapnde
3569fdd9af Disable additional logging in WifiConfigStore/WifiNative
It was introduced to debug the disappearing APs; now that we think that
we've got to the bottom of it, it is being disabled by default. Set VDBG
to true to get it back.

Bug: 10568538

Change-Id: I226cacf48cccba9671f09164bbb50380adc6b322
2013-09-12 14:53:46 -07:00
Robert Greenwalt
dee971b98c Fix Batched Scan Results to give Timestamp in uS
ScanResult should have timestamp in uS but we are getting age in ms
from the wifi driver - multiply to have the same units though not
the implied precision.

bug: 10410465
Change-Id: Idf5c5996d69a4793dae3d74edb790d40b9bd3298
2013-09-12 14:23:51 -07:00
Vinit Deshapnde
b481dae2f5 Merge "Fix invalid Wifi Network system crash" into klp-dev 2013-09-12 20:28:57 +00:00
Robert Greenwalt
126755cf41 Fix Wifi Batch Scanning
Some parsing bugs, more debug logs, etc.

bug:9301872
Change-Id: I245ab00955e245be81a019750be0f8491aa505fd
2013-09-11 19:31:20 -07:00
Dianne Hackborn
95d785346b Fix issue #10688644: Java crash in com.android.phone:
java.lang.SecurityException: Operation not allowed

There was a situation I wasn't taking into account -- components
declared by the system has a special ability to run in the processes
of other uids.  This means that if that code loaded into another
process tries to do anything needing an app op verification, it will
fail, because it will say it is calling as the system package name but
it is not actually coming from the system uid.

To fix this, we add a new Context.getOpPackageName() to go along-side
getBasePackageName().  This is a special call for use by all app ops
verification, which will be initialized with either the base package
name, the actual package name, or now the default package name of the
process if we are creating a context for system code being loaded into
a non-system process.

I had to update all of the code doing app ops checks to switch to this
method to get the calling package name.

Also improve the security exception throw to have a more descriptive
error message.

Change-Id: Ic04f77b3938585b02fccabbc12d2f0dc62b9ef25
2013-09-11 09:59:47 -07:00
Vinit Deshapnde
ba85b970f3 Merge "Set country code on P2p interfaces as well" into klp-dev 2013-09-10 17:32:52 +00:00
Vinit Deshapnde
2c385ecb1c Set country code on P2p interfaces as well
This change will set country code on P2p interfaces as well, so the
drivers are free to use channels that are permitted regionally. This
is required for FCC style compliance and Miracast certification.

Bug: 10513263

Change-Id: I88c645bd488066d5167e23e2772f2e0e1f40fa8a
2013-09-09 16:28:31 -07:00
Vinit Deshapnde
10652a95b1 Fix invalid Wifi Network system crash
There is some validation code that is eventually detecting that we
have an invalid network; only the result is a crash. The right thing
to do is to do validation up front; and fail calls if the network
configuration looks invalid.

Bug: 10571289

Change-Id: I100506b777a34b26ac9a310ba508140560f87a90
2013-09-09 16:24:36 -07:00
Dmitry Shmidt
8e7c1b1222 wifi: Fix cleaning scan result cache
Bug: 10198923

Change-Id: I18dfc10860b8fb623751c62a4bc54b628246cf0c
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-09-06 14:25:14 -07:00
Vinit Deshapnde
771c11b739 Merge "Fix duplicate SSID entries in the WifiSettings UI" into klp-dev 2013-09-06 17:26:39 +00:00
Lorenzo Colitti
eadf1959fb Merge "Track IP addresses in WifiStateMachine." into klp-dev 2013-09-06 03:30:15 +00:00
Lorenzo Colitti
34b2b9b6db Track IP addresses in WifiStateMachine.
This makes WifiStateMachine listen for interface address
changes. When an address changes, WifiStateMachine will update
its LinkProperties to match reality and notify the system that
the link configuration has changed. This allows wifi to keep
track of IPv6 addresses as well (previously it only knew about
the IPv4 address passed in by DHCP).

IP addresses are obtained directly from the kernel and always
match those configured on the interface, so we treat them as
authoritative and ignore addresses passed in via DHCP (by the
time DHCP passes them in we've already been notified by the
kernel anyway).

Since we now have multiple sources of link information (the
kernel for addresses and DHCP for routes and DNS, plus various
bits of static information), also move all the code that sets
mLinkProperties into one place. This allows us to be clearer
about who is authoritative for which parts of mLinkProperties.

Bug: 10232006
Change-Id: I4f262342379ce7fed172b67a1d403e3cd34f4232
2013-09-06 08:21:23 +09:00
Vinit Deshapnde
1ed7a0200a Fix duplicate SSID entries in the WifiSettings UI
The root cause is likely our 'no networks' problem; it caused people
to add new (and duplicate) entries to their list of networks; which
are haunting us now.

This change looks up the dupes, and discards them, even if they came
wifi supplicant.

Bug: 10633813
Change-Id: I656b6bf7240de6763bf84b5b406c50444af6dd48
2013-09-05 14:19:38 -07:00
Vinit Deshapnde
b402fb2fdd Merge "Rename LinkInfo to LinkQualityInfo" into klp-dev 2013-09-05 17:50:19 +00:00
Vinit Deshapnde
6a2d32597a Rename LinkInfo to LinkQualityInfo
This change renames the LinkInfo objects to LinkQuailtyInfo. The API is
still hidden; but it can be accessed via reflection.

Bug: 10342372

Change-Id: Ieccea87c467ceae5d7f76298b137573f67396cd6
2013-09-04 14:11:24 -07:00
Vinit Deshapnde
fab5c2b28e Synchronize access to single supplicant path
Both wlan0 and p2p0 state machines are accessing the supplicant socket
simultaneously; and may get responses of each other's command. This
change introduces synchronization between these two processes.

Bug: 10375978
Change-Id: I0ac0b2771311b642affc353958cc9ba2e5dd5716
2013-08-30 12:31:25 -07:00
Vinit Deshapnde
48c4747106 More elaborate logs to debug missing APs
Bug: 10375978

Change-Id: Ic9bb8f3a7a0684143e4e77f8da0d2c833293c94a
2013-08-28 13:13:40 -07:00
Sreeram Ramachandran
268f329521 Fix channel set option in wifi batch scan command.
Fix by not including extraneous delimiters, and changing the delimiter from a
space to a comma.

Bug: 10444428
Change-Id: Ia3197045d44a2f959316935ae085575500e65459
2013-08-27 14:49:23 -07:00
Vinit Deshapnde
402334a09b Merge "Fix an exception caused by incorrect data handling" into klp-dev 2013-08-26 21:50:20 +00:00