Remove need to call into android_runtime

Save the VM ahead of time, and use that instead
of fetching from AndroidRuntime.

Check the underlying pthreads to verify we're on
the correct thread to make callbacks.

This will ensure we can use the ndk version of
libnativehelper instead.

Bug: 143971120
Test: compile, boot, and check things that invoke callbacks (like discovery) still work
Change-Id: I37b249e40fa7da50b32ecf5dea9974b22a04fd47
2 files changed