Commit Graph

1843 Commits

Author SHA1 Message Date
Jeff Sharkey
f0d7633bdc Add tagging variants for DatagramSocket.
Oops, we missed these along the way.

Bug: 25799174
Change-Id: I4ad368f9faee4b1996d605534dce4c2b23dbe200
2015-12-04 15:32:07 -07:00
Neil Fuller
1d4775fbb2 Merge "Add thread safety documentation" 2015-12-04 11:09:53 +00:00
Neil Fuller
71fbb81b14 Fix @code escapes
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.

Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
2015-12-02 14:24:11 +00:00
Lorenzo Colitti
def4cb0c7d Don't match network requests to legacy API requests.
Currently, we look at network requests that are created by the
current requestNetwork API to see if they look like requests
that could have been created using the legacy
startUsingNetworkFeature API.

This causes those networks to be added to LegacyTypeTracker,
and so cause CONNECTIVITY_ACTION broadcasts, be accessible
using getNetworkInfo(int type), etc. This was done in the L
timeframe so that apps could request networks using the
then-new requestNetwork APIs and still use them using legacy
APIs such as requestRouteToHost.

However, the resulting CONNECTIVITY_ACTION broadcasts are
expensive. requestRouteToHost has been deprecated since L, and
mixing the old and new APIs was never recommended, so it's time
to delete this hack.

Bug: 22513439
Bug: 23350688
Bug: 25295964
Change-Id: Id867058446e5ee44396743d126d26fa57da0c990
2015-11-27 11:46:19 +09:00
Neil Fuller
bf0dc0fba7 Add thread safety documentation
An upcoming change will remove "synchronized" from the API docs. This change
documents those cases where the guarantees can be determined from code
inspection.

Bug: 25767152
Change-Id: I75083ce01513ed315222304fe3f34190d40748cb
2015-11-26 13:33:48 +00:00
Lorenzo Colitti
3c9b733843 Merge "Fix javadoc for the NetworkRequest version of requestNetwork." 2015-11-26 08:16:51 +00:00
Lorenzo Colitti
36728a9f1a Fix javadoc for the NetworkRequest version of requestNetwork.
The documentation for this method says that the request can be
released using releaseNetworkRequest, but that's not true.
releaseNetworkRequest only takes a PendingIntent, and can only be
used to release a request filed with a PendingIntent.

Fix the docs to say that the request needs to be released using
unregisterNetworkCallback.

Change-Id: If044fd2d463ab8d09874172d5d56946251057a3c
2015-11-26 17:06:20 +09:00
Lorenzo Colitti
d117946299 Make the new NetworkRequest flavour consistent with the others.
Change-Id: I491eb0b6d2fa0f1c472c97ef403488407e71803e
2015-11-25 15:47:14 +09:00
Lorenzo Colitti
7754abb2fc Merge "Temporarily add a requestNetwork flavour that takes a legacy type" 2015-11-25 06:37:25 +00:00
Lorenzo Colitti
7de289f355 Temporarily add a requestNetwork flavour that takes a legacy type
This method is public @hide to support progressive refactoring of
tethering away from startUsingNetworkFeature to requestNetwork,
without getting in the way of the CONNECTIVITY_ACTION cleanup in
b/22513439 .

Bug: 9580643
Bug: 22513439
Change-Id: I9053ec746cc8f415a2d5849f044667eeb14e1b19
2015-11-25 12:00:52 +09:00
Przemyslaw Szczepaniak
3f72604be8 Use HexDump instead of java.lang.IntegralToString
java.lang.IntegralToString is being removed, replaced
all its usage by com.android.internal.util.HexDump.

Bug: 24932279
(cherry-picked from 15fc0548a536750110e159e06a39ba943eccdd81)

Change-Id: Id6ab88337af12d93cd73c41775b9d5baa1e61d96
2015-11-20 14:11:02 +00:00
Chad Brubaker
e33f81f81c Merge "Use duck typing in X509TrustManagerExtensions" am: 9c3982f75d am: a26cafc2b2
am: cd03475fc4

* commit 'cd03475fc44ed52939e836b8c3a9426691beedd8':
  Use duck typing in X509TrustManagerExtensions
2015-11-12 23:07:20 +00:00
Chad Brubaker
a26cafc2b2 Merge "Use duck typing in X509TrustManagerExtensions"
am: 9c3982f75d

* commit '9c3982f75da19e2c0e146e7f251514a44412da0c':
  Use duck typing in X509TrustManagerExtensions
2015-11-12 19:33:31 +00:00
Chad Brubaker
bfcd67f71e Use duck typing in X509TrustManagerExtensions
X509TrustManagerExtensions assumes that the default X509TrustManager is
an instance of conscrypt's TrustManagerImpl. That's no longer going to
always be the case. Instead use duck typing to support any
X509TrustManagers that have the extra methods required for
X509TrustManagerExtensions.

Change-Id: If23471bda590d5e131bb1e802a60599957bc7f37
2015-11-11 13:38:33 -08:00
Christopher Tate
0a61b36013 Introduce socket stats tag for restore traffic
As well as system API for emplacing it.

Change-Id: If33fbd23552261efe3b00d75c22ff823564f43e6
2015-11-10 11:13:12 -08:00
Chad Brubaker
ec95c407b4 Add stub isSameTrustConfiguration API
This API will be used in WebView to help determine whether secure
connections to hostname A can be used for secure communication to
hostname B (e.g., HTTP/2 connection pooling).

This is needed because with the new network security configuration a
completely different trust configuration may be used for
foo.com and bar.foo.com, so even if the foo.com certificate contains a
SAN for bar.foo.com it may not be valid for bar.foo.com given the
applications trust configuration.

Change-Id: I87184d392b9a7eca53a9c837996ca7ab5cd5bf12
2015-10-28 14:25:06 -07:00
Erik Kline
1ad4e22534 Also treat loss of IPv6 as a loss of provisioning.
Bug: 23226635
Change-Id: Icebb7d83ed5b3b796901b9f023909a02eb461941
2015-10-27 17:11:27 +09:00
Lorenzo Colitti
67fb3d7358 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a am: bb8f652372
am: 8ecad265b6

* commit '8ecad265b6db57f78dd142e974057c91f69489ed':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:33:09 +00:00
Lorenzo Colitti
8ecad265b6 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev am: 809dcade99 am: bdc458048a
am: bb8f652372

* commit 'bb8f652372f261edd2083103d4300a9173993706':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:28:24 +00:00
Lorenzo Colitti
bdc458048a Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev
am: 809dcade99

* commit '809dcade9906001f6aa51a68aa783e20bb1d7c0d':
  Reinstate CHANGE_NETWORK_STATE as a normal permission.
2015-10-22 06:18:43 +00:00
Lorenzo Colitti
809dcade99 Merge "Reinstate CHANGE_NETWORK_STATE as a normal permission." into mnc-dr-dev 2015-10-22 06:15:05 +00:00
Lorenzo Colitti
d542705066 Reinstate CHANGE_NETWORK_STATE as a normal permission.
This is a partial revert of http://ag/738523 , but not a full
revert because M apps that have gone through the WRITE_SETTINGS
route to obtain permission to change network state should
continue to have permission to do so.

Specifically:

1. Change the protection level of CHANGE_NETWORK_STATE back from
   "signature|preinstalled|appop|pre23" to "normal". This allows
   apps that declare CHANGE_NETWORK_STATE in their manifest to
   acquire it, even if they target the M SDK or above.
2. Change the ConnectivityManager permission checks so that they
   first check CHANGE_NETWORK_STATE, and then ask Settings
   if the app has the WRITE_SETTINGS runtime permission.
3. Slightly simplify the code in the Settings provider code that
   deals specifically with the ability to change network state.
4. Make the ConnectivityService permissions checks use the
   ConnectivityManager code to avoid code duplication.
5. Update the ConnectivityManager public Javadoc to list both
   CHANGE_NETWORK_STATE and WRITE_SETTINGS.

Bug: 21588539
Bug: 23597341
Change-Id: Ic06a26517c95f9ad94183f6d126fd0de45de346e
2015-10-22 08:33:45 +09:00
Jeff Sharkey
71f9a6f7a9 Merge "Ignore network policies with missing IMSI." into mnc-dr-dev am: 38463bb950 am: 5d7604323f am: 3b30aae6e7
am: 647afb199e

* commit '647afb199eb60f20bf3dcc49d48bffd46bb2d0d5':
  Ignore network policies with missing IMSI.
2015-10-20 23:08:08 +00:00
Jeff Sharkey
647afb199e Merge "Ignore network policies with missing IMSI." into mnc-dr-dev am: 38463bb950 am: 5d7604323f
am: 3b30aae6e7

* commit '3b30aae6e702cbdad4ada69b76e4bc50fa2e161c':
  Ignore network policies with missing IMSI.
2015-10-20 18:33:48 +00:00
Jeff Sharkey
5d7604323f Merge "Ignore network policies with missing IMSI." into mnc-dr-dev
am: 38463bb950

* commit '38463bb950390a7b50fb07a990d9ed6990d07539':
  Ignore network policies with missing IMSI.
2015-10-20 17:32:57 +00:00
Jeff Sharkey
56859f323c Ignore network policies with missing IMSI.
In rare cases, we might have created a network policy before an IMSI
was available.  Because this policy is persisted, and we incorrectly
think that it always applies, we end up annoying the user when data
usage goes over the 2GB default warning threshold.

This patch fixes the network matching logic to ignore these empty
network policies when present.

Bug: 24972775
Change-Id: Id26499b6716121dddf0f2c05b848b0bed5995e72
2015-10-19 16:52:08 -07:00
Jerry Wong
32d52f344a Incorrect time used in some NTP server responses
Per RFC 4330, a NTP server response should be discarded when:
    - the stratum is 0 (unspecified), or
    - the leap indicator is 3 (unsync'ed), or
    - the mode is not 4 (server) / 5 (broadcast), or
    - the transmitted time is 0.

Update SntpClient so that such responses would be discarded.

Additionally:
    - make some variables suitably "final"
    - enable logging
    - add alternate requestTime() for testing
    - add some miniscule test coverage

Cherry-picked from Jerry Wong's

    https://partner-android-review.googlesource.com/#/c/460074

Bug: 24719581
Change-Id: Id11a79a6e53ce95500ed4b4d691a29c260666f6c
2015-10-17 03:36:32 +09:00
Jeff Sharkey
75f4786606 resolved conflicts for f20a5700 to master
Change-Id: I1f13a63c3680901fac58ef709118c9242032b11f
2015-10-12 17:51:45 -07:00
Jeff Sharkey
f20a5700a4 am 75051c3a: am 7f6d8754: am a03ecf7d: Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev
* commit '75051c3a62123b4668231d0243ba11462e02ac5a':
  Push firewall rules up to ConnectivityService.
2015-10-12 16:55:58 +00:00
Jeff Sharkey
7f6d8754e6 am a03ecf7d: Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev
* commit 'a03ecf7d7c8ff2844caf5feecc6d29f1f7346ff9':
  Push firewall rules up to ConnectivityService.
2015-10-12 16:39:34 +00:00
Jeff Sharkey
a03ecf7d7c Merge "Push firewall rules up to ConnectivityService." into mnc-dr-dev 2015-10-12 16:34:19 +00:00
Lorenzo Colitti
068da68200 am 553a934c: am 647ec7f8: am 4e4d59ee: Connect the DHCP UDP socket to the server.
* commit '553a934c47ec255b84647fa8e603bd4edf8fd7cd':
  Connect the DHCP UDP socket to the server.
2015-10-11 14:20:04 +00:00
Lorenzo Colitti
647ec7f80e am 4e4d59ee: Connect the DHCP UDP socket to the server.
* commit '4e4d59eeef86fa8560d35c00168869b0a066f962':
  Connect the DHCP UDP socket to the server.
2015-10-11 13:43:34 +00:00
Lorenzo Colitti
4e4d59eeef Connect the DHCP UDP socket to the server.
This makes it so that the socket cannot receive datagrams from
anybody except the DHCP server. This does not improve security,
because we never read from the UDP socket anyway, but it does
make ListeningPortsTest pass.

Bug: 23906864
Bug: 23933386
Change-Id: Ib090273a417f7eb2ac1ee3309260249b72fb8345
2015-10-11 16:06:11 +09:00
Lorenzo Colitti
cccaa51f34 Merge "Connect the DHCP UDP socket to the server." 2015-10-09 04:36:02 +00:00
Lorenzo Colitti
577255e1d4 Connect the DHCP UDP socket to the server.
This makes it so that the socket cannot receive datagrams from
anybody except the DHCP server. This does not improve security,
because we never read from the UDP socket anyway, but it does
make ListeningPortsTest pass.

Bug: 23906864
Bug: 23933386
Change-Id: I82fe9d6c6c520536ffd6422bcc60fab664999e6f
2015-10-09 13:27:22 +09:00
Lorenzo Colitti
89b6392046 Add a null check to hasIPv4AddressOnInterface.
Change-Id: Ie38505ec0a93f4060348d92db341c536b7d60ed0
2015-10-09 12:36:30 +09:00
Erik Kline
02cc5a030a Refactor netlink and IpReachabilityMonitor into services/net
- netlink from core to services/net/netlink
    - IpReachabilityMonitor from core to services/net/ip

Change-Id: I45ac3f591bade45dd5ec441111b02b621234c0e4
2015-09-24 12:50:36 +09:00
Jan Nordqvist
ca30939346 Merge "Hotspot 2.0 relase 2 first cut." 2015-09-23 19:05:53 +00:00
Xiaohui Chen
e4de5a0d3b Cleanup OWNER references.
Bug: 19913735
Change-Id: I2150c6baaab80fe11312e4401394a2a8da52e595
2015-09-23 18:50:11 +00:00
Jan Nordqvist
52eb29f082 Hotspot 2.0 relase 2 first cut.
CP mods to take a URL as a parameter, and new ScanInfo object.

Change-Id: Idbb2d4751c575ba07a56942771e2b2955b624635
2015-09-22 17:24:22 -07:00
Erik Kline
5bcd4477dd am 2a068606: am c89f3a48: am 7aa79efe: Grab a wakelock while doing ARP/ND probing
* commit '2a06860609254ab07ac7c866d8a7435a4245a9f0':
  Grab a wakelock while doing ARP/ND probing
2015-09-21 12:15:39 +00:00
Erik Kline
c89f3a4833 am 7aa79efe: Grab a wakelock while doing ARP/ND probing
* commit '7aa79efe80b790eef61ac355c0ce6c7b606e6f78':
  Grab a wakelock while doing ARP/ND probing
2015-09-21 12:00:25 +00:00
Erik Kline
7aa79efe80 Grab a wakelock while doing ARP/ND probing
Bug: 23197666
Change-Id: I5bf6e83b37fcd924f5f8e750f65bb5061f931e56
2015-09-21 14:59:05 +09:00
Erik Kline
76fde62da7 Grab a wakelock while doing ARP/ND probing
Bug: 23197666
Change-Id: I5bf6e83b37fcd924f5f8e750f65bb5061f931e56
2015-09-18 13:35:15 +09:00
Jeff Sharkey
dc988061ac Push firewall rules up to ConnectivityService.
getActiveNetworkInfo() and friends already know how to augment their
results to help apps detect when network access is blocked.  This
change wires up the new app-idle and device-idle firewall rules to
be reported through these APIs.

This also causes other platform tools like DownloadManager and
SyncManager to respect these new policies.

Bug: 24050462
Change-Id: Id9517b0b70be7e3ca2ab27bed8049db916e4d829
2015-09-14 15:49:36 -07:00
Lorenzo Colitti
51c61ee23a am fd183706: am 22262f31: am 0bc35668: am 017223ac: Merge changes from topic \'packet-keepalive-fixes\' into mnc-dr-dev
* commit 'fd18370675f8794807747a18276dd7385e25f06e':
  Require the new PACKET_KEEPALIVE_OFFLOAD permission.
  Add an error code for generic hardware error.
  Fix bugs and crashes in PacketKeepalive API.
  Add tests for the PacketKeepalive API.
  Add a PACKET_KEEPALIVE_OFFLOAD permission.
  Use a CountDownLatch instead of sleep() in NetworkFactory tests.
  Get rid of shortSleep() in ConnectivityServiceTest.
  Make ConnectivityServiceTest a bit more readable.
2015-09-09 01:04:38 +00:00
Lorenzo Colitti
fd18370675 am 22262f31: am 0bc35668: am 017223ac: Merge changes from topic \'packet-keepalive-fixes\' into mnc-dr-dev
* commit '22262f31b964d595b56eb1277e4d88550a03e54c':
  Require the new PACKET_KEEPALIVE_OFFLOAD permission.
  Add an error code for generic hardware error.
  Fix bugs and crashes in PacketKeepalive API.
  Add tests for the PacketKeepalive API.
  Add a PACKET_KEEPALIVE_OFFLOAD permission.
  Use a CountDownLatch instead of sleep() in NetworkFactory tests.
  Get rid of shortSleep() in ConnectivityServiceTest.
  Make ConnectivityServiceTest a bit more readable.
2015-09-09 00:45:42 +00:00
Lorenzo Colitti
0bc356687e am 017223ac: Merge changes from topic \'packet-keepalive-fixes\' into mnc-dr-dev
* commit '017223acda5bfe16cb87d0a33d72dd28d2fccd3b':
  Require the new PACKET_KEEPALIVE_OFFLOAD permission.
  Add an error code for generic hardware error.
  Fix bugs and crashes in PacketKeepalive API.
  Add tests for the PacketKeepalive API.
  Add a PACKET_KEEPALIVE_OFFLOAD permission.
  Use a CountDownLatch instead of sleep() in NetworkFactory tests.
  Get rid of shortSleep() in ConnectivityServiceTest.
  Make ConnectivityServiceTest a bit more readable.
2015-09-09 00:26:53 +00:00
Lorenzo Colitti
9d1284eba7 Add an error code for generic hardware error.
This is necessary because currently the wifi code just returns
whatever hardware-specific integer it gets back from the HAL,
which is bad because that will be interpreted by the caller as
one of the error codes defined in this class.

In parallel we'll also modify the wifi code to return this new
error code if the hardware returns an error.

Bug: 21405946
Change-Id: Ic9fa1193ced69a4e7ff543e397221c89b10a5a13
2015-09-09 00:16:57 +09:00