Switch get_env_or_die to requireEnv

Fixes: 153099745
Test: manual

The heif decoder may need to continue reading the input from a
JavaInputStreamAdaptor on the AnimatedImageThread. Attach the JVM like
we do for ByteBufferStream and ByteArrayStream.

Similarly, if the AnimatedImageThread is holding a reference to an
AnimatedImageDrawable, it is possible to call its destructor, and
ultimately InvokeListener's destructor or ByteBufferStreamAdaptor's
release_proc on that thread without the JVM attached. Attach in that
case, too.

Change-Id: I84d236eed2fb5c8617533aed0cae4c762d1eb6dd
5 files changed