RpcSession attaches/detaches thread on JVM (second attempt)

If AndroidRuntimeGetJavaVM exists, attach current
thread before the while loop in join, and detach after
the while loop.

This ensures the Java thread is attached / detached
appropriately for binder threads that handles RPC calls.

Test: run aservice on Java services
Bug: 190450693
Change-Id: Ie37aea20047294d4c24c79aa95965d6dde5965b3
3 files changed