* Attach current thread * In Android, the thread doesn't have to be 'Detach' current thread * as application process is only killed and VM does not shut down */
| 293 | * as application process is only killed and VM does not shut down |
| 294 | */ |
| 295 | JNIEnv* AttachCurrentThread() { |
| 296 | JNIEnv* env; |
| 297 | if (activity_->vm->GetEnv((void**)&env, JNI_VERSION_1_4) == JNI_OK) |
| 298 | return env; |
| 299 | activity_->vm->AttachCurrentThread(&env, NULL); |
| 300 | pthread_key_t key; |
| 301 | if (pthread_key_create(&key, DetachCurrentThreadDtor) == 0) { |
| 302 | pthread_setspecific(key, (void*)activity_); |
| 303 | } |
| 304 | return env; |
| 305 | } |
| 306 | |
| 307 | void DetachCurrentThread() { |
| 308 | activity_->vm->DetachCurrentThread(); |
no outgoing calls
no test coverage detected