Add more certificate MIME type mappings.

Bug: 11354402
Change-Id: I8fd361de60e4170546bad8e5e58170768778f00e
Add a cache to ICU.getBestDateTimePattern.

Brings the time down from 7ms to 7us for a cache hit on Nexus 4.

Bug: 11447043

(cherry picked from commit 0fd776f4dbf7c1940c080003f0c7a02d35374ab9)

Change-Id: I6659ff8ea29227777db0c359024f1361a7cb47e6
Add a test for lower case auth scheme handling.

bug: 11473660

(Cherry picked from d87ee0f7b587bf19b7bf4c047aa6e5ab0c5045de)

Change-Id: I42fed52e5fdfe0a0ec99dfc8f77330b37a82f772
Make getInetAddress generate less garbage.

This function is now on the critical path for URLConnection
since OkHttp calls it to figure out what the MTU for the
NetworkInterface is.

This function performs poorly when there are a large
number of interfaces available.

- Read /proc/net/if_inet6 exactly once, instead of
  once per interface.
- List the contents of /sys/class/net exactly once,
  and not once per interface.

Also adds a couple of tests for if_inet6 parsing.

TODO: Add a "zero copy" version of UnsafeByteSequence
and then move readIntFile over to that version.

(Cherry picked from ab6d858336e6db8b5117b78837fee2a9f35fdf2c)

Bug: b/11411129

Change-Id: Ieb1d5f0beaf462721f897a5f6376a4587f3aebaf
Remove UnsafeByteSequence.

Replace it with a smaller, less general class for reading
the contents of a file into a byte array or a string.

Remove the need for an additional buffer and instead read
the contents of the file directly into a buffer owned by
FileReader. Optimise for the case where the length
of the file is known.

This imposes the additional restriction on callers that the
path of the file they're reading is an absolute path. I've
checked that all callers obey that currently.

(Cherry picked from b0674a77ed67e30f2510064b89151002d7f2eb2a)

Bug: b/11411129
Change-Id: Ic020a45051416f2de9a2f78bd5f99a21feff17df
Remove use of UnsafeByteSequence.

We get most of the way there with BAOS in this use case,
except that we pay for additional locking and a call to
Charsets.forName.

JarFileBenchmark results :

AFTER
0% filename=/system/framework/bouncycastle.jar 989706.59 ns; stddev=28699.19 ns @ 10 trials
33% filename=/system/framework/core.jar 1115640.38 ns; stddev=13687.70 ns @ 10 trials
67% filename=/system/framework/framework.jar 1027097.16 ns; stddev=33908.38 ns @ 10 trials

BEFORE
0% filename=/system/framework/bouncycastle.jar 1016998.68 ns; sttdev=9393.46 ns @ 3 trials
33% filename=/system/framework/core.jar 1163348.29 ns; sttdev=42646.58 ns @ 10 trials
67% filename=/system/framework/framework.jar 1042157.91 ns; sttdev=32679.86 ns @ 10 trials

(Cherry picked from b7d186b5f0d2a6406146ad1f366642d86f5e6933)

Bug: b/11411129
Change-Id: Ib94789fb8396b4f2aad31cc8232b6f0bb0672238
Remove unused code from CharsetBenchmark.

This in preparation for removing UnsafeBytesequence.
Split into a separate change so that it's easier to
resurrect if required.

(Cherry picked from 71852e47df6b12fde7103bc559dd2d756eb8ddc4)

Bug: b/11411129
Change-Id: I24b8cd6a56a37d4efc23cfea0b59adc0f065f5a2
Fix ZoneInfoDBTest on devices that have taken a gservices tzdata update.

The tests were assuming that the zygote was always using the
/system/usr/share/zoneinfo copy, but devices that have taken a gservices tzdata
update will be using the /data/misc/zoneinfo/tzdata copy instead.

Bug: 11513357

(cherry picked from commit e086850abf2726d5b5af1d9286fdb32f7146fad3)

Change-Id: If9047a0678efb7bcfe0838cbe602a9c906e1f907
The file in /data overrides the file in /system, not the other way round.

Bug: 11513357

(cherry picked from commit 19263f5b82e89ac1a9cf11a8bdb50076f72ff781)

Change-Id: I84dd9f7407300d0012c6af7d323a2a56030453fb
Clean up CharsetDecoder and CharsetEncoder.

This patch also fixes a few bugs, and a few test bugs, and then the bugs
exposed by fixing those tests.

(cherry picked from commit 6ad37f500b023ef09fd177ad8cd8e2ba0b842cae)

Change-Id: Ia58d30e414cc59c27a1d259e8056523d6df2c6bc
Tests for an already-fixed CharsetEncoder bug.

Bug: 11571917

(cherry picked from commit 7d0998187acb4f0e0ddc030943936c36429efaf1)

Change-Id: I82edae0dd2324a9a5d9f418f72b1a861469044a5
SSLEngine: verify DHE signature

The DHE signature wasn't being verified against the server's
certificate. Refactor some code to allow the same code to be used for
both the server and client to create and check the DHE parameters
signature.

Bug: 11631299
Change-Id: Ie98cdab039c2213fa77e7768e145c08a4fd7ad7b
Fix flakiness in DateIntervalFormatTest.

Bug: https://code.google.com/p/android/issues/detail?id=62139

(cherry picked from commit 205d7f16d2d6a302c401f39a905dc2a05c1f271b)

Change-Id: I841f7fc38132213031c3092fe9309c8d6ad70acf
SSLEngine: Verify server RSA params signature

The client did not verify the signature of server's RSA params in
ServerKeyExchange.

Bug: 11631299
Change-Id: I64b93ea2caf6da100661303c4e7f7e7eff1ae536
SSLEngine: Test that server params are verified

This CL adds tests that check that SSLEngine's handshake fails if the
signature of server params in ServerKeyExchange does not verify.

Bug: 11631299
Change-Id: I16dfa9c07a4f094adc17aadd6fb3fe9eac88103b