From 46d4a1a836a97f8a628830189ec3e0924429c88a Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 18 Mar 2022 01:36:18 +0000 Subject: [PATCH] JavaBBinder::onTransact - log if env null This can happen if ProcessState::self()->joinThreadPool() is called from a thread that is started manually, for instance. Fatal error is kept (would be SIGSEGV). We don't attach to the JVM automatically here because it's a resource-intensive operation to do automatically. Bug: 225134223 Test: N/A Change-Id: Ie75b3ee7591c7c07f79c567866f0d26570cf1a4c --- core/jni/android_util_Binder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index 13ca13322cc7b..f28e2f636dac3 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -396,6 +396,9 @@ protected: { JNIEnv* env = javavm_to_jnienv(mVM); + LOG_ALWAYS_FATAL_IF(env == nullptr, + "Binder thread started or Java binder used, but env null. Attach JVM?"); + ALOGV("onTransact() on %p calling object %p in env %p vm %p\n", this, mObject, env, mVM); IPCThreadState* thread_state = IPCThreadState::self();