Handle Bitmap reuse failure more gracefully

A feature in Android 3.0 allows Bitmaps to be reused when
loading a bitmap of the same dimensions. A documented limitation
is that the only formats supported are jpeg and png, the most common
formats for Android. But if you actually try to do it anyway, you'll end
up causing memory trashing and an eventual strange native crash. It's not
pretty.

This fix puts code in other possible image format decoders (gif, ico, and
bmp) to return false from the onDecode() operation, which will result in
an exception being thrown back to the user code.

Issue #6146246 Sparodic crash in GraphicsJNI::allocateJavaPixelRef (memory corruption?)

Change-Id: Ifd3e0f87c9ea6d41a37f58616e1ced0b19132056
5 files changed