Re-enable HeapprofdJavaCtsTest.

Add workaround. If we tried to get a dump too early in the app
initialization, we would sometimes deadlock.

This passes > 50 runs of `atest HeapprofdJavaCtsTest`. The flakiness
rate was > 10 %, so it's very unlikely (< 0.5 %) that this is still
flaky.

Bug: 143467832
Change-Id: Icd937d0b280a7c19e3687e34455d637b1ae6a86e
diff --git a/test/cts/heapprofd_java_test_cts.cc b/test/cts/heapprofd_java_test_cts.cc
index 1175513..a1a6108 100644
--- a/test/cts/heapprofd_java_test_cts.cc
+++ b/test/cts/heapprofd_java_test_cts.cc
@@ -42,6 +42,9 @@
   StartAppActivity(app_name, "target.app.running", &task_runner,
                    /*delay_ms=*/100);
   task_runner.RunUntilCheckpoint("target.app.running", 1000 /*ms*/);
+  // TODO(b/143467832): Remove this workaround.
+  // If we try to dump too early in app initialization, we sometimes deadlock.
+  sleep(1);
 
   // set up tracing
   TestHelper helper(&task_runner);
@@ -92,24 +95,21 @@
   }
 }
 
-// TODO(b/142919213): Re-enable once no longer flaky.
-TEST(DISABLED_HeapprofdJavaCtsTest, DebuggableAppRuntime) {
+TEST(HeapprofdJavaCtsTest, DebuggableAppRuntime) {
   std::string app_name = "android.perfetto.cts.app.debuggable";
   const auto& packets = ProfileRuntime(app_name);
   AssertGraphPresent(packets);
   StopApp(app_name);
 }
 
-// TODO(b/142919213): Re-enable once no longer flaky.
-TEST(DISABLED_HeapprofdJavaCtsTest, ProfileableAppRuntime) {
+TEST(HeapprofdJavaCtsTest, ProfileableAppRuntime) {
   std::string app_name = "android.perfetto.cts.app.profileable";
   const auto& packets = ProfileRuntime(app_name);
   AssertGraphPresent(packets);
   StopApp(app_name);
 }
 
-// TODO(b/142919213): Re-enable once no longer flaky.
-TEST(DISABLED_HeapprofdJavaCtsTest, ReleaseAppRuntime) {
+TEST(HeapprofdJavaCtsTest, ReleaseAppRuntime) {
   std::string app_name = "android.perfetto.cts.app.release";
   const auto& packets = ProfileRuntime(app_name);