Merge pull request #8117 from weihuoya/threaded_env

android: get java env from thread local storage
This commit is contained in:
Connor McLaughlin 2019-06-08 20:42:15 +10:00 committed by GitHub
commit bed2d66bed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 70 deletions

View file

@ -237,10 +237,8 @@ void Touchscreen::Motor::SetState(ControlState state)
void Touchscreen::Motor::Rumble(int padID, double state)
{
JNIEnv* env;
IDCache::GetJavaVM()->AttachCurrentThread(&env, nullptr);
JNIEnv* env = IDCache::GetEnvForThread();
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetDoRumble(), padID, state);
IDCache::GetJavaVM()->DetachCurrentThread();
}
} // namespace Android
} // namespace ciface