From: Brian Carlstrom Date: Mon, 18 Aug 2014 22:38:34 +0000 (-0700) Subject: AttachCurrentThread should only warn on missing thread name if CheckJNI is enabled. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=21ecab6effd08ed781d55fbb53b0e71c526c25fa;p=android-x86%2Fart.git AttachCurrentThread should only warn on missing thread name if CheckJNI is enabled. Bug: 17108693 (cherry picked from commit 3ea69c0abce1b81b3c45033867d49b00e6d6b709) Change-Id: Ide8158cc3e12e604f4fa344cd881fe6f68476ab7 --- diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 8a85e0df8..4bd99436e 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -907,11 +907,7 @@ void Runtime::BlockSignals() { bool Runtime::AttachCurrentThread(const char* thread_name, bool as_daemon, jobject thread_group, bool create_peer) { - bool success = Thread::Attach(thread_name, as_daemon, thread_group, create_peer) != NULL; - if (thread_name == NULL) { - LOG(WARNING) << *Thread::Current() << " attached without supplying a name"; - } - return success; + return Thread::Attach(thread_name, as_daemon, thread_group, create_peer) != NULL; } void Runtime::DetachCurrentThread() { diff --git a/runtime/thread.cc b/runtime/thread.cc index dbb42c919..61a627df1 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -404,6 +404,8 @@ Thread* Thread::Attach(const char* thread_name, bool as_daemon, jobject thread_g if (thread_name != nullptr) { self->tlsPtr_.name->assign(thread_name); ::art::SetThreadName(thread_name); + } else if (self->GetJniEnv()->check_jni) { + LOG(WARNING) << *Thread::Current() << " attached without supplying a name"; } }