jni: Use RAII to manage callback environment

CallbackEnv is a new RAII object which:
 - Retrieves the callback environment when instantiated
 - Clears exceptions when it goes out of scope
 - Centralizes checks that we are in the correct environment

It can be used the same as a pointer to JNIEnv with the -> operator and
the JNIEnv pointer can be retrieved with get();

Test: basic functionality tests
Change-Id: I004f2655e2e02847782fec794faa62da85c85d49
13 files changed