Initial Contribution
Code drop from //branches/cupcake/...@124589
auto import from //depot/cupcake/@135843
auto import from //depot/cupcake/@135843
"External allocation" tracking for direct buffers.

The native memory allocated for ByteBuffer.allocateDirect was not being
tracked by the VM's "external allocation" mechanism.  This adds the
necessary calls to the Harmony OSMemory allocator, which is what
actually calls malloc().

The external alloc stuff just takes size values, so we tuck a copy of
the allocation size into the allocated block, and pull it out when it's
time to free the memory.

(Includes in a couple of other changes that I had to commit somewhere so
I could sync.)
First parts of enabling a host Dalvik build.

Most of this is just factoring out common make defs to include both on
the host and device side, though there is a little bit of code change
to be slightly POSIX friendlier and to avoid unnecessary sanity checks
when compiling without an asm version of the interpreter.

This patch should cause no difference in build results, except if you
turn on the newly-defined WITH_HOST_DALVIK build flag. If you do turn
it on, at this point you should probably expect the build to fail due
to insufficient dependencies, which I of course expect to address in
upcoming patches.
More work on getting Dalvik to build on the host (particularly OSX).

The dalvikvm executable still doesn't quite build (fails in linker), which
is probably due to the core library native code not getting compiled and
linked. Unfortunately, it looks like that will be pretty hairy to untangle.

Change-Id: Ib5de623e43a40116c4b7459a45a246d76886edf3
Expose the portable "strerror_r" used by jniThrowIOException.

Also add one example caller I used to test this, and update the
libnativehelper README file.
Clear pending exception before throwing a new one.

The JNI helper function that throws an exception calls FindClass, which
isn't allowed if an exception is currently pending.  Some of our code
called this when an operation failed without noting that the thing that
failed already threw an exception; this caused the VM to blow up in a
rather unhelpful way.

We now log the class name and optional message from the original
exception, clear it, and then allocate & throw the new one.

For bug 2141867.
Change the host build to include whole static libraries, and to name
them "*-host".

Change-Id: Ibf565c9c4b0709eb25edd71786b269895a1616a4
Remove dead native org.apache.harmony.nio.AddressUtils code.

This code is dead at the moment, and were it ever to become live, I'm pretty
sure we'd want to start again from scratch rather than do whatever the author
of this had in mind.
Clone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick)
laggard libc implementations not keeping up with the times or
(perhaps) agressively modern libc implementations too eagerly
expanding upon the standard.

Change-Id: I4c4d050d15a00f4e82f8beb2b9c386b7c652f495
Merge change I4c4d050d

* changes:
  Clone TEMP_FAILURE_RETRY in JNIHelp.h, to make up for (take your pick) laggard libc implementations not keeping up with the times or (perhaps) agressively modern libc implementations too eagerly expanding upon the standard.
eclair snapshot
merge from open-source master

Merge commit 'goog/stage-korg-master' into HEAD
am d829c399: merge from open-source master

Merge commit 'd829c39941df81efe05eb3e974cfc048ce2d47f2'

* commit 'd829c39941df81efe05eb3e974cfc048ce2d47f2':
  eclair snapshot
Two exception-related tweaks: (1) Make the dynamic exception construction
mechanism be able to handle exception constructors that take Object instead
of String. (2) Add a convenience in JNIHelp to throw RuntimeExceptions.

Change-Id: Ie5ce680c30043a4b186e59d7c8883666648b2c87
am 4a888b09: Two exception-related tweaks: (1) Make the dynamic exception construction mechanism be able to handle exception constructors that take Object instead of String. (2) Add a convenience in JNIHelp to throw RuntimeExceptions.

Merge commit '4a888b09be2ade9fc5bb0137f702b3be889679a9' into eclair-plus-aosp

* commit '4a888b09be2ade9fc5bb0137f702b3be889679a9':
  Two exception-related tweaks: (1) Make the dynamic exception construction
am bf1bb914: am 4a888b09: Two exception-related tweaks: (1) Make the dynamic exception construction mechanism be able to handle exception constructors that take Object instead of String. (2) Add a convenience in JNIHelp to throw RuntimeExceptions.

Merge commit 'bf1bb914a62c65eb8304ce1d86e8ff2dd4f5c79b' into eclair-mr2-plus-aosp

* commit 'bf1bb914a62c65eb8304ce1d86e8ff2dd4f5c79b':
  Two exception-related tweaks: (1) Make the dynamic exception construction
am 66cbe5b1: am bf1bb914: am 4a888b09: Two exception-related tweaks: (1) Make the dynamic exception construction mechanism be able to handle exception constructors that take Object instead of String. (2) Add a convenience in JNIHelp to throw RuntimeExceptions.

Merge commit '66cbe5b10e3bd9f7b3c262a2ec8a3c11087baa80'

* commit '66cbe5b10e3bd9f7b3c262a2ec8a3c11087baa80':
  Two exception-related tweaks: (1) Make the dynamic exception construction