Manage jclass objects (and most jobjects) in jni code using ScopedLocalRef

for safer refcounting. Previously jclass objects were not DeleteLocalRef'ed
at all, leading us to exhaust the local ref pool quickly in certain
circumstances.

This change also makes sure we properly serialize int64_t entries when
converting from AMessage to HashMap and boosts thread priority for
java-instantiated MediaCodecs slightly from NORMAL to FOREGROUND.

Change-Id: I4ebdd8a5ca6b3442698c9f86fcc31af8c199aaf5
2 files changed