Update our MIME type map.

Bug: https://code.google.com/p/android/issues/detail?id=61996
Change-Id: I55efc9d38c87d89bb20073e4632ab1e06c77be09
Fix MimeUtils to treat ".flac" as "audio/flac".

(cherry-pick of 77926e913a14b9541df38b6175f795f2ca6c5266.)

Bug: 15715370
Change-Id: I2d99f070c3debea01621a172d8189951a56736b5
Switch Random to use AtomicLong

This removes the synchronization from next() and replaces the seed with
an AtomicLong.

Change-Id: I4ed94e0290dad83ed7570a8e7fd906e025df4636
Improve URI.equals performance.

The main improvement is that we're vastly reducing
the amount of garbage this method creates.

Also, get rid of some incorrect checks and add a new
benchmark test case.

Before vs. After:

URI                            Equals     1540.1 =
URI EqualsWithHeavilyEscapedComponent 11921397.1 ==============================

URI                            Equals     1337.2 =
URI EqualsWithHeavilyEscapedComponent   588934.3 ==============================

Change-Id: I9ddb87b8267f0ac6a3ac85c2989cc0dd305ef6a1
Allow multiple gzip members in gzip streams.

We look for the gzip magic bytes at the end of every
member and try to decompress the remainder of the
stream if we find it.

Note that this changes the behaviour of this class wrt.
the underlying stream: It is no longer self limiting. It
will attempt to read past the gzip trailer to look for
more data to decompress. Before this change, it would've
been possible to (hackily) consume the rest of the compressed
stream directly by inspecting the value of
InflaterInputStream.inf.getRemainingBytes(). It's no longer
possible to sensibly support that.

bug: https://code.google.com/p/android/issues/detail?id=63873

Change-Id: I818f77c052a811ed98b76243f2ad8a1a4d236d70
GZIPInputStream: avoid leaks in init.

If we throw inside the ctor, it is impossible for clients
to pass the CloseGuard test for the associated Inflater.

Change-Id: I6c4e66a98742fbd15bcdd03aa03e2fa7e33e110b
Don't account buffer.arrayOffset() twice.

data[OUTPUT_OFFSET] from the perspective of native
code must always be the offset from the start of the
buffer passed in to it.

Change-Id: I4a5c9595aebd105c57ce2239dc95cf85d5bd6256
Implement equals and hashCode in ParameterizedTypeImpl

and GenericArrayTypeImpl.

Bug: 14590652
Bug: https://code.google.com/p/android/issues/detail?id=74060
Change-Id: Ib9a30b741a8d5f82d21f37ca8959bf5b2893f8db
Avoid wrapping Class in WeakReference when class loader is null.

Fix a missing case from one constructor by delegating to another.

Change-Id: I8b85c97586dde2d72c9ac21216c594aa810d761b
Fix abuse of Runtime.freeMemory.

Runtime.freeMemory is the largest allocation that's
possible *without a heap expansion*. That's a poor proxy
for "can i allocate this byte array" and leads to flaky
CTS tests.

bug: 17021619
Change-Id: I108138bf2402e899a40a0b3081c083f733e7c999
Removing some compiler-warning suppressions from EnumMap

The original motivation was to fix a report that
line 162 does not compile with newer compilers:
https://code.google.com/p/android/issues/detail?id=73244

There are a lot of compiler warning suppressions which made
the problem less obvious than it should have been.
The fact it compiled before was possibly a compiler bug.
This change removes a lot of the suppression, and where it
cannot be removed it narrows the scope to just local-variable
declarations. One method-level suppression remains.

This commit also adds a bug fix for situations where the raw
type is being used and an EnumMap is being created from an
existing Map. Previously a NullPointerException would have been
thrown if the first key found was not actually an enum, now a
ClassCastException will be thrown.

Some additional comments have been added and some loops made
into foreach.

Bug: https://code.google.com/p/android/issues/detail?id=73244
Change-Id: I7f23744dc55237a94e5906e77720a9595caa64e8
Fix ZoneInfo.useDaylightTime()

Currently implemented is "are there any offset transitions
in the future?".
This is wrong: Transitions may occur in the future because
of DST, but can also occur for other reasons (e.g. if the
raw offset for a zone changes).

We should be implementing: Is the currently active transition,
or any transition in the future, one that has
isDst == true.

This was causing a test failure in
libcore.java.util.TimeZoneTest#testDisplayNames
for Asia/Novokuznetsk and Europe/Simferopol for
tzdata2014g. This is because they have a transition entry
for October 26, 2014 (i.e. in the future).

For each, the existance of the transition entry is not
due to an offset change at all:
For Asia/Novokuznetsk it is because the abbreviation
for the zone changes on that date (information we don't
curently use).
For Europe/Simferopol it is because the offset from
UTC changes on that date (but there is no actual DST
transtion).

Bug: 17377276

(cherry-picked from commit d42af6ed0fec3cfca52912b0d8b3b459e72be4b4)

Change-Id: I148503280b8dee653bac32eec3aa58d232102628
libcore changes to support ConnectionPool cache flushing

A set of observer / listener components for network
events.

Party A, e.g. the Android ConnectivityManager, can make
changes to network configuration that impacts the java
network objects (e.g. connection pools, caches, etc.).

Party B, e.g. Android libcore network components are
interested in network configuration changes.

The NetworkEventDispatcher enables Party A to communicate
with Party B without hardcoding their details. Additional
parties like B can be added.

Bug: 17314604
(cherry-picked from commit b1e60e2015b81c285938ca569b66edda63d6533d)

Change-Id: Ie0d0a8afe14e6a15253ce72f1abf9b996176e02f
Change FinalizerWatchdogDaemon to not hold objects live

Previously, waitForFinalization would hold whatever object was being
finalized live for MAX_FINALIZE_NANOS even though the finalizer on
this object was run much earlier. This caused a test to be flaky since
it was assuming that the JNI weak global reference of a recently
finalized object wouldn't be held live.

Bug: 17305633

(cherry picked from commit 6ba680664fa14a547543a8c63708543ea8072680)

Change-Id: Ide60db55190a3764c16e4919a7c71a113cbf3968
DO NOT MERGE: Add a way to get all values of an attribute of DN.

This is needed to switch Apache HTTP hostname verification from its
own Distinguished Name (DN) parsing code to this library's
DistinguishedNameParser.

Bug: 16510257

(cherry picked from commit 7bbe7cb0a77527a8d4043315f70c156b2447b462)

Change-Id: I4a20729dad557aebe0bd055736777e34b51167e8
Implements some math functions for faster performance

Changes cosh, exp, expm1, log, log10, sinh, cbrt,
asin, acos, atan, tanh, log1p
These functions are now implemnted in java to
save the overhead of a jni call

Change-Id: I4d3b70dd1693378af5b04cbbe0fecd95d97c1cff
Implements some StrictMath functions for improved performance.

The functions ceil, floor, hypot, IEEEremainder, nextafter, and rint
have all been implemented in Java to save the native call. Benchmarking
numbers to show this performance improvement are included:

Native call (before change):
  benchmark=Ceil: 97.40 ns; σ=0.02 ns @ 3 trials
  benchmark=Floor: 98.73 ns; σ=0.02 ns @ 3 trials
  benchmark=Hypot: 714.62 ns; σ=0.44 ns @ 3 trials
  benchmark=IEEEremainder: 180.31 ns; σ=0.08 ns @ 3 trials
  benchmark=NextAfterD: 110.47 ns; σ=0.02 ns @ 3 trials
  benchmark=NextAfterF: 96.20 ns; σ=0.01 ns @ 3 trials
  benchmark=Rint: 92.21 ns; σ=0.02 ns @ 3 trials

Java implementation (after change):
  benchmark=Ceil: 47.32 ns; σ=0.01 ns @ 3 trials
  benchmark=Floor: 42.03 ns; σ=0.00 ns @ 3 trials
  benchmark=Hypot: 69.42 ns; σ=0.37 ns @ 3 trials
  benchmark=IEEEremainder: 49.64 ns; σ=0.04 ns @ 3 trials
  benchmark=NextAfterD: 63.32 ns; σ=0.17 ns @ 3 trials
  benchmark=NextAfterF: 64.67 ns; σ=0.12 ns @ 3 trials
  benchmark=Rint: 31.10 ns; σ=0.41 ns @ 10 trials

Change-Id: I9ee926514c0661cdb7a1e6ae3acfe5c31a4b9f20
Only allow once GC request at a time.

There is no reason to allow multiple, allocating threads may have
multiple GC requests before the GC starts.

Bug: 17942071

(cherry picked from commit 71891f9da2fbcb865931da70ae759032e6698106)

Change-Id: I5e2162373bcef1027eb71e5b1699186ff015f92d
Merge remote-tracking branch 'nameless/android-4.4' into kk-mr2.1

Conflicts:
	luni/src/main/java/java/util/zip/GZIPInputStream.java