Revert "Revert "ART: Add ThreadGroup API support""

This reverts commit 87071bfb6c1b708bdfa2a5f91d4744667b3a0443.

Add an ObjectLock, which corresponds to the synchronized(this)
implementation on the Java side. Wait for the expected five
child threads in the root group before running the actual
child test.

Bug: 31455788
Change-Id: Ib7a065d6a11f06f0325e3a8db040629f3ca69407
Test: m test-art-host-run-test-925-threadgroups
diff --git a/runtime/openjdkjvmti/OpenjdkJvmTi.cc b/runtime/openjdkjvmti/OpenjdkJvmTi.cc
index 4aedec9..d9aea01 100644
--- a/runtime/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/runtime/openjdkjvmti/OpenjdkJvmTi.cc
@@ -58,6 +58,7 @@
 #include "ti_redefine.h"
 #include "ti_stack.h"
 #include "ti_thread.h"
+#include "ti_threadgroup.h"
 #include "ti_timers.h"
 #include "transform.h"
 
@@ -205,13 +206,13 @@
   static jvmtiError GetTopThreadGroups(jvmtiEnv* env,
                                        jint* group_count_ptr,
                                        jthreadGroup** groups_ptr) {
-    return ERR(NOT_IMPLEMENTED);
+    return ThreadGroupUtil::GetTopThreadGroups(env, group_count_ptr, groups_ptr);
   }
 
   static jvmtiError GetThreadGroupInfo(jvmtiEnv* env,
                                        jthreadGroup group,
                                        jvmtiThreadGroupInfo* info_ptr) {
-    return ERR(NOT_IMPLEMENTED);
+    return ThreadGroupUtil::GetThreadGroupInfo(env, group, info_ptr);
   }
 
   static jvmtiError GetThreadGroupChildren(jvmtiEnv* env,
@@ -220,7 +221,12 @@
                                            jthread** threads_ptr,
                                            jint* group_count_ptr,
                                            jthreadGroup** groups_ptr) {
-    return ERR(NOT_IMPLEMENTED);
+    return ThreadGroupUtil::GetThreadGroupChildren(env,
+                                                   group,
+                                                   thread_count_ptr,
+                                                   threads_ptr,
+                                                   group_count_ptr,
+                                                   groups_ptr);
   }
 
   static jvmtiError GetStackTrace(jvmtiEnv* env,