Android: Partly revert r29569 and only call the new getJavaEnvironment() when needed.