Commit Graph

842 Commits

Author SHA1 Message Date
Lorenzo Colitti
45aca20cd7 Rework the per-network URL API.
This addresses API council comments.

Bug: 17112978
Change-Id: I698b243b2b685d1f25414cee72450be3ae0c2bf0
2014-08-21 19:09:27 -07:00
Jeff Davidson
6047c1dc68 Less intrusive VPN dialog and other UX tweaks.
-The ability to launch VPNs is now sticky; once approved by the user,
further approvals are not needed UNLESS the connection is revoked in
Quick Settings.

-The old persistent notification has been removed in favor of the new
Quick Settings UI.

-The name of the VPN app is now pulled from the label of the VPN
service rather than the app itself, if one is set.

Bug: 12878887
Bug: 16578022
Change-Id: I102a14c05db26ee3aef030cda971e5165f078a91
2014-08-20 16:55:28 -07:00
Lorenzo Colitti
ef734f8a3b Stop using LinkProperties for static configuration.
LinkProperties can represent way more complicated configurations
than what we can actually apply to interfaces. This makes it
error-prone to use it to represent static configuration, both
when trying to apply configuration coming from LinkProperties
and when trying to save configuration from current
LinkProperties.

Instead, move static configuration (IPv4 only, since we don't
support static IPv6 configuration) into a separate
StaticIpConfiguration class.

Bug: 16114392
Bug: 16893413
Change-Id: Ib33f35c004e30b6067bb20235ffa43c247d174df
2014-08-19 11:59:43 -07:00
Robert Greenwalt
debf0e0075 Add tcp buffer size conduit to NetworkAgent.
bug: 16549611
Change-Id: I7d97dedea2c7c1aed2eccb185645889424508591
2014-08-17 15:14:29 -07:00
Robert Greenwalt
36a05df3f3 Merge "Configure MTU based on network MTU parameter" into lmp-dev 2014-08-15 19:10:34 +00:00
w19976
e714f1daa6 Configure MTU based on network MTU parameter
Add logic to obtain the mtu from the network PCO parameter and set it to kernel
when the mobile data connection is established. When there is no PCO mtu configured
from the network, the mtu size defined in the corresponding APN will be used. In case
no mtu size is defined for an APN used for data connection, the MCC/MNC based MTU
defined  in the framework overaly will be applied.

bug:17046179
Change-Id: I6465d4b8f2076aaa380ae3617fb3f24adbe136d4
2014-08-14 20:34:13 -07:00
Jeff Sharkey
f2ceed8a54 Some networks may have null ifaces, I guess?
Seems like a bug further upstream, but guard ourselves against it
for now.

Bug: 17033841
Change-Id: Id0e5895c3389b63d4e34b1fb064efef8b72cd609
2014-08-14 22:42:27 +00:00
Lorenzo Colitti
435565dd96 Switch RouteInfo to use IpPrefix instead of LinkAddress.
This addresses a TODO and also makes it possible to create
routes to destinations that are not valid LinkAddresses, such as
multicast addresses.

Bug: 16875580
Change-Id: Id4c77b00dc3064bf27d78cdcbbe035e645748cfe
2014-08-13 21:17:20 +09:00
Jeff Sharkey
0aef9341d3 Hack and ship: NetworkStats edition.
Some devices use clatd for catching raw IPv4 traffic when running on
a pure-IPv6 carrier network.  In those situations, the per-UID
stats are accounted against the clat iface, so framework users need
to combine both the "base" and "stacked" iface usage together.

This also means that policy rules (like restricting background data
or battery saver) need to apply to the stacked ifaces.

Finally, we need to massage stats data slightly:

-- Currently xt_qtaguid double-counts the clatd traffic *leaving*
the device; both against the original UID on the clat iface, and
against UID 0 on the final egress interface.

-- All clatd traffic *arriving* at the device is missing the extra
IPv6 packet header overhead when accounted against the final UID.

Bug: 12249687, 15459248, 16296564
Change-Id: I0ee59d96831f52782de7a980e4cce9b061902fff
2014-08-11 18:40:23 -07:00
Dan Sandler
3d2c4da534 Fix docs build.
Change-Id: I3be4c5b74e85d2491316986d8c3c0575cd01a8fc
2014-07-31 02:27:52 -04:00
Lorenzo Colitti
8d20c50093 Allow using third-party HTTP/... stacks for per-network URLs.
Also switch to double-checked locking for
mNetworkBoundSocketFactory and OkHttpClient.

Change-Id: Ic52776ee760036ad5623b7496156b8909dc282fa
2014-07-31 02:17:28 +00:00
Lorenzo Colitti
54a8d4c170 Use a new socket for each of the host's IP addresses.
If Socket.connect() times out, the socket cannot be used any
more - any attempt to do so fails with EBADF. Use a new
socket for each IP address.

Bug: 16664129
Change-Id: If3616df86f7c2da0eabd30dca5db65d0da85cb17
2014-07-30 17:31:04 +00:00
Sreeram Ramachandran
e458632059 Allow VPNs to add/remove link addresses dynamically.
Bug: 15409819
Change-Id: If91fc6891d7ce04060362c6cde8c57462394c4e8
2014-07-29 00:32:59 +00:00
Robert Greenwalt
73b0009b50 Merge "Remove dead code 1." into lmp-dev 2014-07-24 20:48:02 +00:00
Sreeram Ramachandran
6ba91ae8a0 Prohibit address families by default unless a VPN explicitly allows them.
Bug: 15972465
Change-Id: I3278d94536fefacc86390c1ba4231680f7be8589
2014-07-28 18:52:41 +00:00
Robert Greenwalt
c36a74f2a6 Remove dead code 1.
Starting with startUsingNetworkFeature and stop.
Figure it's easier to code review incremental changes.

Change-Id: I19aee65e740858c3a9a2a1a785663f6fee094334
2014-07-28 11:34:36 -07:00
Lorenzo Colitti
b9ab4282cf Add a getBoundURL method that returns a network-specific URL.
Change-Id: I4b57e675bb87064ab75dcc36b00fdc7a2987b86e
2014-07-28 16:16:58 +00:00
Sreeram Ramachandran
3518e37286 Implement support for bypassable VPNs.
Bypassable VPNs grab all traffic by default (just like secure VPNs), but:
+ They allow all apps to choose other networks using the multinetwork APIs.
  If these other networks are insecure ("untrusted"), they will enforce that the
  app holds the necessary permissions, such as CHANGE_NETWORK_STATE.
+ They support consistent routing. If an app has an existing connection over
  some other network when the bypassable VPN comes up, it's not interrupted.

Bug: 15347374
Change-Id: Iaee9c6f6fa8103215738570d2b65d3fcf10343f3
2014-07-25 15:17:23 -07:00
Robert Greenwalt
abbc41e859 Fix DUN-based tethering.
It was calling into dead ConnectivityService code rather than using
the new ConnectivityManager shim code.

bug:15221541
Change-Id: I1e3eea8a658a162ce36673ed1cf7b1e7e4372c42
2014-07-24 14:39:51 -07:00
Ye Wen
ca7ababe8b Infer legacy network type for ConnectivityManager.requestNetwork
ConnectivityManager.requestNetwork pass TYPE_NONE to
sendRequestForNetwork which prevents it from being used with legacy API
requestRouteToHostAddress. This CL infers the legacy network type
automatically from the network capabilities.

b/16324360

Change-Id: I591d38f875f42f56e8cfc157db2069c9eee0ee26
2014-07-23 11:41:17 -07:00
Sreeram Ramachandran
c06ec73149 Cleanup: Delete dead code.
Bug: 15413389
Change-Id: I315468832ef18ffc84174e54774ab63b86d284dc
2014-07-22 15:46:34 -07:00
Sreeram Ramachandran
b5ae69d410 Remove unnecessary code and APIs.
This stuff has been replaced by setNetworkForUser() in NetdClient.

Change-Id: If525ee259b74314191d1913f7c2a3e828e05c38f
2014-07-11 18:16:04 -07:00
Paul Jensen
5dea435dd4 Readjust location of NETID_UNSET definition.
This is a tweak to my 8ec11bb change I a-little-too-hastily committed.

Change-Id: Ibeee9382109994c66227d1c42aac749e2a274ed7
2014-07-11 16:53:39 +00:00
Paul Jensen
65743a26ad Define NETID_UNSET in ConnectivityManager.
This allows some cleanup and removal of dead code.

bug:15489928
Change-Id: Iaf0507bc2e8ec6dcc253f01f61c5b221d46581f9
2014-07-11 12:00:10 -04:00
Robert Greenwalt
bd7397eb5b Missed an entry in the copy constructor.
bug:15755597
Change-Id: Iee17ca88404a6a50258d204a12cd0c04cd15e34e
2014-07-10 14:55:14 -07:00
Robert Greenwalt
a6bc0916e7 Add networkSpecifier string to NetworkCapabilties.
Allows transport specific network selectivity where multi-sim or sta+sta
is supported.

bug:1575597
Change-Id: I9c60fe7710e988c17d63236788b492a3ddd264a1
2014-07-10 20:58:20 +00:00
Paul Jensen
8b5fc62d12 Convert Vpn from NetworkStateTracker to NetworkAgent.
This eliminates the need for the ConnectivityService.VpnCallback class.
This requires shifting VPNs to the new "network" netd API.
VpnService.protect() is modified to no longer go through ConnectivityService.
NetworkCapabilities is extended to add a transport type for VPNs and a
capability requiring a non-VPN (so the default NetworkRequest isn't satisfied
by a VPN).

bug:15409918
Change-Id: Ic4498f1961582208add6f375ad16ce376ee9eb95
2014-07-10 20:39:33 +00:00
Robert Greenwalt
1166831856 Merge "Refactor wifi p2p's startDhcpServer function" 2014-07-10 18:27:37 +00:00
Robert Greenwalt
e594a76c9f Refactor wifi p2p's startDhcpServer function
Add getTetheredDhcpRanges() interface and call it before calling
mNwService.startTethering to update dhcp ranges.  This will allow
p2p apps to run well concurently with other tethering apps.

Manual import of AOSP change 81546 by jianzheng.zhou@freescale.com

Change-Id: Iebc62f95bdcedde80e2c1d3e9580d3f625c3b50b
2014-07-10 18:56:12 +00:00
Robert Greenwalt
02fe11eba3 Add Network inspection API.
Adds getNetworksNetworkInfo.
Adds getAllNetworks.

Cleans up some synchronization issues.

Change-Id: I82c7a4b554e3c6c1adfe6027cc54b028ed6dbac9
2014-07-10 10:48:23 -07:00
Robert Greenwalt
a134636a4b Add Trust to NetworkCapabilities.
Indicates the user has indicated implicit trust of a network.  This
generally means it's a sim-selected carrier, a plugged in ethernet,
a paired BT device or a wifi they've asked to connect to.  Untrusted
networks are probably limited to unknown wifi AP.

Change-Id: I89490bdaa3c2d63d33f876c72d8b088dc155fa3d
2014-07-08 23:55:18 +00:00
Robert Greenwalt
ce7a144472 Remove dead code.
Also adds a TYPE_VPN so the VPN can be strongly typed.

Change-Id: Ibf39450c480f16ce5ab4c25b47965691b844fb92
2014-07-07 17:09:01 -07:00
Robert Greenwalt
f7c7336625 Merge "Remove unused api." 2014-07-02 18:55:10 +00:00
Glenn Kasten
b20d886bce Fix build
Change-Id: I7d0787e4a1f778008c979c4174ef445a950c4250
2014-07-07 07:12:29 -07:00
Robert Greenwalt
e0b0051472 Remove unused api.
bug:15595155
Change-Id: Ifd79365bd45f20f531782244f471a4cfc32a4135
2014-07-02 13:50:33 -07:00
Paul Jensen
e378679df9 Add captive portal sign-in actions.
Change-Id: I70a6c2efc4f3fa48d5b65e8d630682fe74abfe2c
2014-07-02 16:47:48 +00:00
Paul Jensen
bb427685db Make sure callback handler is in place before callbacks handled.
When making Network requests in ConnectivityManager, make sure we install the
callback prior to a response from ConnectivityService arriving causing us to
search for the callback and inadvertently not find it.

bug:15928097
Change-Id: Ie5feb9cc8f5effc19870f54dba07218b2e11d82a
2014-07-02 13:50:53 +00:00
Ram
693d07a0b4 MS: Adding Support for Emergency APN in Telephony Framework
(base/telephony)

Replacement for https://partner-android-review.googlesource.com/#/c/171175/

Change-Id: I16fc37f5c00ed79f2370bc46554fc7a24c52c4cb
Conflicts:
	core/java/android/net/ConnectivityManager.java
2014-07-01 02:00:51 +00:00
Paul Jensen
10ba60a4a1 Use return values from JNI functions binding sockets and processes to networks.
bug:15757549
Change-Id: If23b14febc923b9a0348f0cf9029fd4bf6e8d725
2014-06-26 16:33:58 +00:00
Lorenzo Colitti
131eb31373 Modify DNS server update methods.
1. Make addDnsServer not add duplicate servers and return a
   boolean value incating whether it changed anything. This is
   consistent with what we do for LinkAddresses and routes.
2. Add a setDnsServers method that sets all the DNS servers to
   the specified collection. This is consistent with what we do
   for LinkAddress.

Bug: 9180552
Change-Id: I5baed09253261b66ea42ae2ea82398118e3ab0ac
2014-06-26 17:04:38 +09:00
Lorenzo Colitti
fc854695c1 Teach LinkProperties whether it's provisioned or not.
In IPv4, a link is provisioned when DHCP succeeds. In IPv6, a
there is no such signal, because addresses and DNS servers can
be notified by the kernel at different times.

Add an isProvisioned method that returns true if we believe that
enough information has configured to use a network. For IPv6,
this requires an IP address, default route, and DNS server. For
IPv4, this requires only an IPv4 address, because we support
static configuration that doesn't have a default route or DNS
server.

To do this we use the existing hasIPv4Address method, rename the
all-but unused hasIPv6Address method to hasGlobalIPv6Address
(which is what we want anyway) and add new hasIPv[46]DefaultRoute
and hasIPv[46]DnsServer methods.

Bug: 9180552
Change-Id: Ib2f5ff8af920f7b6f1edf0e2afaaa0edce9bc72d
2014-06-26 03:23:31 +09:00
Lorenzo Colitti
99064fa3ae Minor changes to RouteInfo.
1. Realize that mDestination can never be null and update the
   code accordingly.
2. Simplify isDefaultRoute.
3. Provide two new hidden utility methods, isIPv4Default() and
   isIPv6Default(), that can be used by LinkProperties to
   to determine if the system has connectivity.
4. Update tests.

Bug: 9180552
Change-Id: I85028d50556c888261d250925962bdedfe08e0c6
2014-06-25 18:22:12 +00:00
Lorenzo Colitti
3897f1a407 Unbreak LinkPropertiesTest.
This was broken by the changes that made addRoute add routes
only if they did not already exist.

Change-Id: I1d227df9223fbecf106efde05b709f320824ee9d
2014-06-25 18:19:47 +00:00
Robert Greenwalt
52228dd7cf Clean up and add some Network logging.
Dumps the netid for the Network and adds that to the NetworkAgentInfo.

Change-Id: Id9fbcc55ca55bf1a020f747f0c44902efb1b5f87
2014-06-23 17:40:12 -07:00
Robert Greenwalt
7ee7824678 Merge "Add logging to track down weird ConnectivityManager issue." 2014-06-23 21:44:43 +00:00
Robert Greenwalt
b8401730a8 Add logging to track down weird ConnectivityManager issue.
bug:15771399
Change-Id: I0a7150286f94262414005298e6f038f278347a7c
2014-06-23 15:33:40 -07:00
Lorenzo Colitti
36ddd9d00c Modify LinkProperties add/remove route functions.
This will allow us to dynamically track routes being added and
removed, similar to what we do for IP addresses.

1. Support removing routes. Since this is a new function, we
   don't need to jump through hoops to support callers passing
   in routes that have no interface, we just fail to match them.
2. Make the addRoute method return a boolean value indicating
   whether anything changed. This is consistent with what we do
   for addresses and is used to decide whether to update the
   rest of the system when an update comes in.

Bug: 9180552
Change-Id: I50648b5f81ec55c88501a7640e119cda2bb540f2
2014-06-17 11:18:53 +09:00
Lorenzo Colitti
174bab2a0d IpPrefix improvements.
1. Allow IpPrefixes to be created from strings. In order to do
   this, factor out the code from LinkAddress which already does
   this to a small utility class in NetworkUtils.
2. Truncate prefixes on creation, fixing a TODO.
3. Add a toString method.
4. Write a unit test.

While I'm at it, make RouteInfoTest pass again, and convert it
to use IpPrefix instead of LinkAddress.

Change-Id: I5f68f8af8f4aedb25afaee00e05369f01e82a70b
2014-06-17 11:18:53 +09:00
Lorenzo Colitti
3718680598 Assert that RT_SCOPE_* and IFA_F_* are not zero.
If these constants are zero (or, rather, if they're not all
different), the test will fail with more cryptic error messages
whose cause is not obvious. Clearly check for that here.

Bug: 15602893
Change-Id: I7ca4a9c5e3d592fd93fbfa1b50666a1861a0031d
2014-06-13 17:20:20 +09:00
Robert Greenwalt
f72c856009 Merge "Fix build" 2014-06-12 05:34:42 +00:00