207 Commits

Author SHA1 Message Date
Pierre Imai
bc9cc50947 Move connectivity events to frameworks/base.
Fixes a crash in bluetooth' DhcpClient due to Class(not)Loader.

Change-Id: I318c033aa8782c27a243104f85950adbf07d03a6
BUG: 27885860
BUG: 25691077
2016-03-29 22:07:09 +09:00
Lorenzo Colitti
37127f8620 Add a toString method to ApfCapabilities.
Change-Id: I505b90b7cd818cb3477990ec6b41b16db46d1c08
2016-03-28 17:33:30 +09:00
Lorenzo Colitti
5812e64850 Rename IpManager#dumpApf to #dump and change its signature.
Also give it a bit of indentation.

Bug: 26991160
Change-Id: I8a85276e76e15f452075931747552b486598f0e9
2016-03-28 17:32:19 +09:00
Paul Jensen
f21b4dc1d6 Move ApfFilter from ConnectivityService to IpManager
There's a few advantages to having ApfFilter in IpManager:
1. If things go wrong, crashing a particular transport is less bad then
   crashing ConnectivityService.  We also don't want to use
   ConnectivityService as a dumping ground for transport-specific logic.
2. This makes implementing WifiManager.MulticastLock a lot simpler and
   safer because enabling/disabling it doesn't have to go through the
   NetworkAgent, which could risk various races (e.g. installing a filter
   into the wrong WiFi network).
3. IpManager is the ultimate source for LinkProperties for a particular
   transport and since ApfFilter uses the LinkProperties it's better to
   have it closely paired with the IpManager. Likewise, ApfFilter needs
   to know the APF capabilities of the transport, so having it in
   the transport avoids having to parcel this information through the
   NetworkAgent.

Bug: 26238573
Change-Id: I99b85f2b64972f0e7572170ec5d1926081aa3429
2016-03-25 07:46:07 -04:00
Erik Kline
a5265e47d8 Merge "Request vendor info option (43) to get metered hint" into nyc-dev 2016-03-25 07:08:00 +00:00
Pierre Imai
55618be44c Add initial connectivity metrics handling.
Adds initial support for IP connectivity metrics collection (DHCP
client, IP reachability monitor, network monitor, connectivity
service).

Change-Id: If9a0455f2a34aa9abea90f9c1b38e4d895dc1a72
2016-03-25 13:21:41 +09:00
Erik Kline
1d511ab13d Request vendor info option (43) to get metered hint
Bug: 26241591
Change-Id: I688029826a79f9cbf0116fb197f82026980788af
2016-03-25 11:55:19 +09:00
Lorenzo Colitti
f55c9c1781 Don't crash if we get a DHCP packet with the wrong port.
This should only happen if we get a packet in the small time
window between binding the packet socket and programming the
BPF filter on it.

Bug: 26696823
Change-Id: I481f1bc74bbaeb9646d96e1841d2a69acdb47d62
2016-03-09 16:16:45 +09:00
Joe Onorato
f188d41fa2 Turn down the logging a little bit and don't do a log wrapper function.
Change-Id: I109f04c2c2299f26e21b076df3a935ce2d356bdf
2016-03-04 12:21:30 -08:00
Erik Kline
24f7d5e655 Add 464xlat notification callback
am: 8d6edc3270

* commit '8d6edc3270616b119645fbdf8752c0ea37de0731':
  Add 464xlat notification callback
2016-03-02 08:37:06 +00:00
Erik Kline
8d6edc3270 Add 464xlat notification callback
Bug: 26238390
Bug: 26991160
Change-Id: I556e779c642d19cd8d26637dd98055157d005f77
2016-03-02 16:50:46 +09:00
Erik Kline
e5a5f84fef Add constructor with more inputs for dependency injection.
am: b9df11099f

* commit 'b9df11099f16ca816a69e06f1327eb1f86723578':
  Add constructor with more inputs for dependency injection.
2016-03-01 06:10:40 +00:00
Erik Kline
b9df11099f Add constructor with more inputs for dependency injection.
Bug: 26991160
Bug: 27406552
Change-Id: If4a0a2f1afb1da4ad59df9eb31c540047c84659b
2016-03-01 14:58:30 +09:00
Erik Kline
13daed9fea Add WaitForProvisioningCallback
am: 111d55658b

* commit '111d55658bce1bcc3eb61b4aeaa4d8a256165b02':
  Add WaitForProvisioningCallback
2016-02-22 04:29:37 +00:00
Erik Kline
69ce6a0fc5 Support setting TCP buffer sizes and HTTP Proxy config
am: d0e843b8ef

* commit 'd0e843b8ef4218ba8f69a8a53b3eeaf21e667deb':
  Support setting TCP buffer sizes and HTTP Proxy config
2016-02-22 04:11:28 +00:00
Erik Kline
111d55658b Add WaitForProvisioningCallback
This centralizes code that is shared by both bluetooth and ethernet
transport layers.

Bug: 26991160
Change-Id: I8e2dd8580c29c86394119768e3a5529850b4b859
2016-02-22 13:02:02 +09:00
Erik Kline
d0e843b8ef Support setting TCP buffer sizes and HTTP Proxy config
This allows IpManager to send callback recipients a more satisfying
LinkProperties.

Bug: 26991160
Change-Id: I2eb60dc633e5be38dad9410a1096d0095ddf57a0
2016-02-22 12:50:44 +09:00
Lorenzo Colitti
a2a9ab947f Add a MessageUtils class to convert int constants to strings.
am: d2457a3ee3

* commit 'd2457a3ee39ea55ed8e302bd93feede793cb5055':
  Add a MessageUtils class to convert int constants to strings.
2016-02-19 05:01:56 +00:00
Lorenzo Colitti
d2457a3ee3 Add a MessageUtils class to convert int constants to strings.
This class uses reflection to find accessible static integer
members in a specified list of classes and returns a SparseArray
mapping the integers to their names. This will allow us to
replace various 400-line switch statements with a simple
array access.

Change-Id: I3607e6389a423cde0bd83270c00b3c863ae1bb29
2016-02-19 10:26:55 +09:00
Erik Kline
7651b21fe9 {,Base}DhcpStateMachine is no more
am: efa4209fe0

* commit 'efa4209fe022d007f48edc3c4feaef00a9865cb5':
  {,Base}DhcpStateMachine is no more
2016-02-18 04:38:38 +00:00
Erik Kline
efa4209fe0 {,Base}DhcpStateMachine is no more
Bug: 26991160
Change-Id: I21f8c30627bf2a7fbcd5b4d5f1f1ad1a2dda759b
2016-02-18 12:56:45 +09:00
Erik Kline
907b255ebf Remove references to BaseDhcpStateMachine and DhcpStateMachine
am: 29a215268d

* commit '29a215268dfa18f5023dc3c06b33db68e91ae316':
  Remove references to BaseDhcpStateMachine and DhcpStateMachine
2016-02-17 13:06:49 +00:00
Erik Kline
29a215268d Remove references to BaseDhcpStateMachine and DhcpStateMachine
Bug: 26991160
Change-Id: I3742780a4e5121c163d9d1380951e25edaba19f3
2016-02-17 21:44:25 +09:00
Erik Kline
5c78685d56 Add IpManager#shutdown() to terminate the state machine.
am: b1ee39540e

* commit 'b1ee39540ead2e4ee74d4dba9ee1b84211766221':
  Add IpManager#shutdown() to terminate the state machine.
2016-02-17 12:20:19 +00:00
Erik Kline
b1ee39540e Add IpManager#shutdown() to terminate the state machine.
Additionally, remove IpManager.Callback#usingIpReachabilityMonitor()
now that this is now longer used.

Bug: 26991160
Change-Id: I9a17497c82238a9fb37a20d01aeca7bc4913ae2c
2016-02-17 20:54:10 +09:00
Erik Kline
209fd91dae Add IpManager.ProvisioningRequest class
am: 93b1a36e31

* commit '93b1a36e31b42c5b33a0164f2832ab9aa12d9a00':
  Add IpManager.ProvisioningRequest class
2016-02-16 10:15:09 +00:00
Erik Kline
93b1a36e31 Add IpManager.ProvisioningRequest class
This class captures provisioning request parameters to be passed to
IpManager#startProvisioning().

Bug: 26991160
Change-Id: I56652bbc4b9ae6cfca3f225a8d99cdfc01bb54d9
2016-02-16 18:11:47 +09:00
Erik Kline
09bf13574e Duplicate DhcpStateMachine public constants into DhcpClient
This is so we can ultimately delete DhcpStateMachine altogether.

Bug: 24837343
Bug: 26991160
Change-Id: If116639e5f72c97cfc67f748dc5f6433dccd9cf0
2016-02-12 19:02:39 +09:00
Erik Kline
3b74289fdf Duplicate DhcpStateMachine public constants into DhcpClient
This is so we can ultimately delete DhcpStateMachine altogether.

Bug: 24837343
Bug: 26991160
Change-Id: If116639e5f72c97cfc67f748dc5f6433dccd9cf0
2016-02-12 17:10:15 +09:00
Erik Kline
16e1e55271 Use IpManager.ifname as the tag in log messages.
am: ef1f39abff

* commit 'ef1f39abff088789853e8747418310534cf2127e':
  Use IpManager.ifname as the tag in log messages.
2016-02-11 13:27:27 +00:00
Erik Kline
ef1f39abff Use IpManager.ifname as the tag in log messages.
Bug: 26991160
Change-Id: Idc9231819298b65da3cc3baa88f1f0cd18ab6df7
2016-02-11 21:07:07 +09:00
Erik Kline
db338c2e90 Merge "Incorporate historical WifiStateMachine notions of provisioning." into mm-wireless-dev
am: f94dc18746

* commit 'f94dc18746d93e98d2e48cdd25b799aa20a142ab':
  Incorporate historical WifiStateMachine notions of provisioning.
2016-02-10 22:13:31 +00:00
Erik Kline
990fc4968d Incorporate historical WifiStateMachine notions of provisioning.
Also: considerably expand logging capabilities.

Bug: 26991160
Change-Id: I36c3c1d2158ffd178e8ce163b8799d62938f39c7
2016-02-11 03:21:48 +09:00
Paul Jensen
8514a8131f Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev
am: 44307adcf3

* commit '44307adcf371bacad4de6925a9207bdbfdc6f874':
  Android packet filtering program interpreter test & program generator
2016-02-03 17:12:47 +00:00
Paul Jensen
44307adcf3 Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev 2016-02-03 16:48:43 +00:00
Paul Jensen
d38fb7662d Android packet filtering program interpreter test & program generator
Change-Id: I17951bd6320b9eb3b6c43f2ae37f62c2025705c1
2016-02-03 10:19:13 -05:00
Erik Kline
3d51d8bacc Ignore link properties updates when nothing actually changed.
am: 6076cb0b85

* commit '6076cb0b859185b075d3a70655afb192d68d0774':
  Ignore link properties updates when nothing actually changed.
2016-02-03 14:37:11 +00:00
Erik Kline
d33e6232fe Partial unification of DHCPv4 and static IPv4 configuration codepaths
am: 8deac7793c

* commit '8deac7793c32be0c3b64b64d48dd9c0e2407e8db':
  Partial unification of DHCPv4 and static IPv4 configuration codepaths
2016-02-03 14:29:32 +00:00
Erik Kline
6076cb0b85 Ignore link properties updates when nothing actually changed.
Change-Id: Ia3c0a652cb3b67707a5c5a0bb40f991ef1e6f777
2016-02-03 22:42:54 +09:00
Erik Kline
8deac7793c Partial unification of DHCPv4 and static IPv4 configuration codepaths
Change-Id: Ic796f9b7bb853a332175c34e0f557588efb6247a
2016-02-03 22:42:53 +09:00
Erik Kline
0c96d715c1 Move DHCPv4 mechanics into IpManager
am: 8afa558c52

* commit '8afa558c527b4be4e0e489b17485577e23148636':
  Move DHCPv4 mechanics into IpManager
2016-02-03 08:44:13 +00:00
Erik Kline
8afa558c52 Move DHCPv4 mechanics into IpManager
Bug: 17345682
Change-Id: I2c3d9d665ff3c38f02084c0cf86cd76035e7b0aa
2016-02-03 17:23:45 +09:00
Erik Kline
59235e66a5 Support static IP configuration internally
am: 1e91e4ebb6

* commit '1e91e4ebb65e63969e6ae45503257852be017aee':
  Support static IP configuration internally
2016-02-02 04:07:58 +00:00
Erik Kline
1e91e4ebb6 Support static IP configuration internally
Also, stop passing around "reason" for IPv4 provision success
or failure.

Bug: 17345682
Change-Id: I4c4b22977a93048e0b291206721d0ccc77cfaaf2
2016-02-01 22:32:21 +09:00
Erik Kline
4cc9ef8c74 Initial refactoring to group IP-related elements into an IpManager
am: a636761bd6

* commit 'a636761bd67963385397ee920dcf76ec7cf113fb':
  Initial refactoring to group IP-related elements into an IpManager
2016-02-01 10:08:40 +00:00
Erik Kline
a636761bd6 Initial refactoring to group IP-related elements into an IpManager
Bug: 17345682
Change-Id: I88f3f4bd32d18cd8d4f1404493648c8bcc1deeec
2016-02-01 17:59:47 +09:00
Erik Kline
7cb501310e DO NOT MERGE Refactor netlink and IpReachabilityMonitor into services/net
- netlink from core to services/net/netlink
    - IpReachabilityMonitor from core to services/net/ip

Cherry-picked from 02cc5a030a6f132e776b754dd5684ae632009f76
Change-Id: I45ac3f591bade45dd5ec441111b02b621234c0e4
2015-12-10 16:06:50 -08:00
Lorenzo Colitti
bda01cc5e3 Fix canceling renew alarms.
1. Entering DhcpBoundState cancels the renew alarm, but at that
   point the renew alarm is guaranteed not to have been scheduled.
   This is harmless, but results in an "unknown listener" message
   in the AlarmManager logs.
2. We don't cancel the renew alarm when exiting DhcpBoundState.
   This is also harmless, because that alarm does nothing except
   in DhcpBoundState, and we cancel it whenever we enter
   DhcpBoundState. But canceling it on exit is more correct.

Change-Id: I60dfcf00f243253b81b8906540e0a6218a7a489c
2015-12-10 12:58:27 +00:00
Lorenzo Colitti
9d3aadb247 Add a new WakeupMessage class and use it in two places.
This is useful when using the new AlarmManager direct callback
interface to wake up the system and request that an object whose
API consists of messages (such as a StateMachine) perform some
action.

In this situation, using AlarmManager.onAlarmListener by itself
will wake up the system to send the message, but does not
guarantee that the system will be awake until the target object
has processed it. This is because as soon as the onAlarmListener
sends the message and returns, the system is free to go to sleep
again.

Bug: 20157436
Bug: 25823676
Change-Id: Idff20029d287f26347441a2523b7fb20eda6a8b0
2015-12-08 23:50:23 +09:00
Lorenzo Colitti
c415f72b66 Merge changes I456984a2,Id4d1031b
* changes:
  Switch the DHCP client to the new AlarmManager callback interface
  Refactor alarm setting code in preparation for switch to callback
2015-11-25 04:37:59 +00:00