Fix DumpUnattachedThreads logic for CTS.

The thread should not be in thread list when dumping from
DumpUnattachedThread.

Bug:140968481
Bug:188918448
Bug:188918454
Test:CtsWindowManagerDeviceTestCases android.server.wm.AnrTests

Signed-off-by: wangguibo <wangguibo@xiaomi.com>
Change-Id: Icc4c7907c5386280c04d8e56496361e32cbac350
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index efc354c..84b7384 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -175,7 +175,7 @@
         MutexLock mu(self, *Locks::thread_list_lock_);
         thread = FindThreadByTid(tid);
       }
-      if (thread != nullptr) {
+      if (thread == nullptr) {
         DumpUnattachedThread(os, tid, dump_native_stack);
       }
     }