frameworks/base: Fix aliasing violations

Fix violations of strict aliasing rules

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
frameworks/base: Fix compile errors

Fix ISO C++11 incompatibility in TextLayoutCache and
aliasing violation in FontRenderer

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
frameworks/base: Fix various aliasing violations

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	core/jni/Android.mk

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>

Conflicts:
	core/jni/Android.mk

Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Fixed VM memory leak in AudioSystem JNI interface

The function android_media_AudioSystem_error_callback from AudioSystem
JNI interface is using FindClass function but does not delete the
reference created by VM in this function.
By doing this call, VM will add a local reference in IndirectRefTable
and it's the caller's job to delete this reference.
By not doing this, everytime this callback is called, a new reference is
added and never deleted.
The effect is crashing the VM running system_server:

E/dalvikvm( 3071): JNI ERROR (app bug): local reference table overflow (max=512)
W/dalvikvm( 3071): JNI local reference table (0x732da288) dump:
W/dalvikvm( 3071):   Last 10 entries (of 512):
W/dalvikvm( 3071):       511: 0x42a90008 java.lang.Class<android.os.Parcel>
W/dalvikvm( 3071):       510: 0x4381fd90 android.view.KeyEvent
W/dalvikvm( 3071):       509: 0x439b9808 android.view.KeyEvent
W/dalvikvm( 3071):       508: 0x42d2fe18 java.lang.Class<com.android.server.input.InputManagerService>
W/dalvikvm( 3071):       507: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       506: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       505: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       504: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       503: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):       502: 0x42ad4298 java.lang.Class<android.media.AudioSystem>
W/dalvikvm( 3071):   Summary:
W/dalvikvm( 3071):       510 of java.lang.Class (3 unique instances)
W/dalvikvm( 3071):         2 of android.view.KeyEvent (2 unique instances)
E/dalvikvm( 3071): Failed adding to JNI local ref table (has 512 entries)
...
E/dalvikvm( 3071): VM aborting

In this case, PID 3071 is system server.

Change-Id: I0c113eb72256984854d59a3ccef11a8d23f96e79
Signed-off-by: Robert Chiras <robert.chiras@intel.com>
Signed-off-by: houst0nn <houstonn@gmail.com>
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>
Fix JNI error in exception reporting.

There was a JNI error where when you got an OOM and called
report_exception, it would call two NewStringUTF in a row without
checking the return values. This could mean that the first one
threw a new OOME and the second one would cause a JNI error when
it also attempted to throw an OOME with a pending OOME.

Bug: 16843627
Change-Id: Ie4f9f9a5f8b7993cd3655d42a6718c0a5e1199f8
Signed-off-by: Chet Kener <Cl3Kener@gmail.com>