Add sample profiling interface to startMethodTracing.

Libcore side of this change. Also changed art and frameworks base.

Change-Id: Ie26982dfb09d4098708d701b5429fd09e710a25d
Speed-up for apps that use Dagger on ART

This is more of a harm-free heuristic improvement than a fix.
It rearranges the algorithm for determining whether a Field
(or Constructor/Method) is annotated. A cheap check (does the
Field/Method/Constructor has any annotations at all?) is pushed
ahead of a more expensive one (If the annotation were to be
present, what would its type index be?). This happens to work
well in practice in sample apps because the cheap check often
fails, allowing the algorithm to terminate earlier.

The second change is to skip() the field information
rather than to read each field in turn when looking for Method
or Constructor annotation information.

The second change is not a hotspot but looks like an easy
optimization that avoids many small method calls and a for
loop for little additional complexity.

Change-Id: I2118d650f2f1db4e103384483684306e42809093
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
Fix several decoder bugs.

- NativeConverter should report unterminated character
  sequences to managed code.
- CharsetDecoderIcu should report those errors correctly
  from flush()
- InputStreamReader should check the return value of
  flush() and not ignore it altogether.

bug: 11665359
bug: 10729779

Change-Id: Ic678a645a4ef2b3fe70e2c900c0cd393679f1037

Conflicts:
	harmony-tests/src/test/java/org/apache/harmony/tests/java/io/InputStreamReaderTest.java
CipherInputStream: increase buffers for speed

This increases speed of CipherInputStreamBenchmark from 606ms to 28.5ms.

Bug: 12246774
Change-Id: If61c0a055fe1b8e87909711b15d0441fcdbe46c7

Conflicts:
	luni/src/test/java/libcore/javax/crypto/CipherInputStreamTest.java
Fix CTS test failure under ART

The Thread.interrupted() State from
SelectorTest.testInterrupted() was leaking into
SelectorTest.testManyWakeupCallsTriggerOnlyOneWakeup() causing
that test to fail when the CTS was run with the ART. Under
Dalvik the "interrupted" state was being reset, but it was
causing the test runner to run each subsequent test in its
own Dalvik instance (which probably slowed down the tests but
wasn't causing failures).

It is unclear why a Thread being in "interrupted" after a test
does not cause problems for ART in the same way it causes
problems for Dalvik.

Bug: 12905142
Change-Id: I677c1d46602d10e174ba3b6b8614529b5c902104
Fix Thread.sleep(0) of an interrupted thread

Bug: 12929305
Change-Id: I3061c3345c68de8bcf438e6935446b4f7cd76001

Conflicts:
	luni/src/test/java/libcore/java/lang/ThreadTest.java
Switch Random to use AtomicLong

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

Change-Id: I4ed94e0290dad83ed7570a8e7fd906e025df4636
Improve detection of CloseGuard protected resource leakage

* Add CloseGuardMonitor to intercept and collate CloseGuard reports and if
  necessary throw an exception listing the resource leaks.
* Add ResourceLeakageDetector to abstract away the CloseGuardMonitor which will
  not work on RI.
* Add AbstractResourceLeakageDetectorTestCase as a base class for tests
  that need to detect resource leaks, in future this could be handled by
  modifications to Cts and Vogar test runners.
* Remove CloseGuardTester and its sole usage in ProcessBuilderTest.
* Remove CloseGuardGuard from within URLConnectionTest
* Change ZipFileTest, ZipInputStreamTest, ZipOutputStreamTest,
  ProcessBuilderTest, URLConnectionTest to use new mechanism, fix issues that
  are identified and do some cleanup/remove duplicated code.

Bug: https://code.google.com/p/android/issues/detail?id=66383
Change-Id: Id026dbb6bc66091a15f07329e6371cd0d1f32cf5

Conflicts:
	luni/src/test/java/libcore/java/util/zip/ZipFileTest.java
	luni/src/test/java/libcore/java/util/zip/ZipInputStreamTest.java
Support explicit + in Byte, Short, Integer, Long.

Bug: 5239391
Change-Id: I2b25228815d70d570d537db0ed9b5b759f25b5a3
Remove Zygote.fork

Currently unused, all callers use forkAndSpecialize.

Change-Id: I61df8ed88d7657da8280e044fe99517c47ce8dff