Prevent deadlocks in Runtime::Abort.

If we have the threads suspended, attempting to use a
ScopedObjectAccess causes a deadlock. We now specifically avoid this
to prevent deadlocks.

Bug: 13747880
Change-Id: I45fd3fff917da98b22970e5351a9e25b143a4eed
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 5a2410a..131e2b6 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -711,7 +711,9 @@
   bool is_daemon = false;
   Thread* self = Thread::Current();
 
-  if (self != nullptr && thread != nullptr && thread->tlsPtr_.opeer != nullptr) {
+  // Don't do this if we are aborting since the GC may have all the threads suspended. This will
+  // cause ScopedObjectAccessUnchecked to deadlock.
+  if (gAborting == 0 && self != nullptr && thread != nullptr && thread->tlsPtr_.opeer != nullptr) {
     ScopedObjectAccessUnchecked soa(self);
     priority = soa.DecodeField(WellKnownClasses::java_lang_Thread_priority)
         ->GetInt(thread->tlsPtr_.opeer);