Rename setters to conform Android API guidelines

Bug: 184654804
Test: m droid
Merged-In: I6ae5dd363bdb32cea6acd9dab7afbd4579fb0c4c
Change-Id: I6ae5dd363bdb32cea6acd9dab7afbd4579fb0c4c
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index 7a640a4..f74e120 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -33,11 +33,11 @@
 
 namespace art {
 
-static void DdmVmInternal_enableRecentAllocations(JNIEnv*, jclass, jboolean enable) {
+static void DdmVmInternal_setRecentAllocationsTrackingEnabled(JNIEnv*, jclass, jboolean enable) {
   Dbg::SetAllocTrackingEnabled(enable);
 }
 
-static void DdmVmInternal_threadNotify(JNIEnv*, jclass, jboolean enable) {
+static void DdmVmInternal_setThreadNotifyEnabled(JNIEnv*, jclass, jboolean enable) {
   Dbg::DdmSetThreadNotification(enable);
 }
 
@@ -210,8 +210,8 @@
 }
 
 static JNINativeMethod gMethods[] = {
-  NATIVE_METHOD(DdmVmInternal, enableRecentAllocations, "(Z)V"),
-  NATIVE_METHOD(DdmVmInternal, threadNotify, "(Z)V"),
+  NATIVE_METHOD(DdmVmInternal, setRecentAllocationsTrackingEnabled, "(Z)V"),
+  NATIVE_METHOD(DdmVmInternal, setThreadNotifyEnabled, "(Z)V"),
   NATIVE_METHOD(DdmVmInternal, getStackTraceById, "(I)[Ljava/lang/StackTraceElement;"),
   NATIVE_METHOD(DdmVmInternal, getThreadStats, "()[B"),
 };
diff --git a/test/130-hprof/src/Main.java b/test/130-hprof/src/Main.java
index a8597f1..38e004f 100644
--- a/test/130-hprof/src/Main.java
+++ b/test/130-hprof/src/Main.java
@@ -117,10 +117,10 @@
         if (klass == null) {
             throw new AssertionError("Couldn't find path class loader class");
         }
-        Method enableMethod = klass.getDeclaredMethod("enableRecentAllocations",
-                Boolean.TYPE);
+        Method enableMethod = klass.getDeclaredMethod("setRecentAllocationsTrackingEnabled",
+            boolean.class);
         if (enableMethod == null) {
-            throw new AssertionError("Couldn't find path class loader class");
+            throw new AssertionError("Couldn't find setRecentAllocationsTrackingEnabled method");
         }
         enableMethod.invoke(null, true);
         Object o = allocInDifferentLoader();
diff --git a/test/145-alloc-tracking-stress/src-art/Main.java b/test/145-alloc-tracking-stress/src-art/Main.java
index cf82d78..990fef7 100644
--- a/test/145-alloc-tracking-stress/src-art/Main.java
+++ b/test/145-alloc-tracking-stress/src-art/Main.java
@@ -38,10 +38,10 @@
       if (klass == null) {
           throw new AssertionError("Couldn't find DdmVmInternal class");
       }
-      enableAllocTrackingMethod = klass.getDeclaredMethod("enableRecentAllocations",
-              Boolean.TYPE);
+      enableAllocTrackingMethod = klass.getDeclaredMethod("setRecentAllocationsTrackingEnabled",
+          boolean.class);
       if (enableAllocTrackingMethod == null) {
-          throw new AssertionError("Couldn't find enableRecentAllocations method");
+          throw new AssertionError("Couldn't find setRecentAllocationsTrackingEnabled method");
       }
 
       final Thread[] threads = new Thread[numberOfThreads];
diff --git a/test/1940-ddms-ext/src-art/art/Test1940.java b/test/1940-ddms-ext/src-art/art/Test1940.java
index 14cf6a8..605e409 100644
--- a/test/1940-ddms-ext/src-art/art/Test1940.java
+++ b/test/1940-ddms-ext/src-art/art/Test1940.java
@@ -65,8 +65,8 @@
   }
 
   private static final class MyDdmHandler extends ChunkHandler {
-    public void connected() {}
-    public void disconnected() {}
+    public void onConnected() {}
+    public void onDisconnected() {}
     public Chunk handleChunk(Chunk req) {
       System.out.println("MyDdmHandler: Chunk received: " + printChunk(req));
       if (req.type == MY_DDMS_TYPE) {
@@ -222,14 +222,14 @@
         }
       });
     CURRENT_HANDLER = wait_thd;
-    DdmVmInternal.threadNotify(true);
+    DdmVmInternal.setThreadNotifyEnabled(true);
     System.out.println("threadNotify started!");
     final Thread thr = new Thread(() -> { return; }, "THREAD");
     thr.start();
     System.out.println("Target thread started!");
     thr.join();
     System.out.println("Target thread finished!");
-    DdmVmInternal.threadNotify(false);
+    DdmVmInternal.setThreadNotifyEnabled(false);
     System.out.println("threadNotify Disabled!");
     wait_thd.Await();
     // Make sure we saw at least one of Thread-create, Thread name, & thread death.
diff --git a/tools/ahat/src/test-dump/Main.java b/tools/ahat/src/test-dump/Main.java
index ca18fd8..2e29076 100644
--- a/tools/ahat/src/test-dump/Main.java
+++ b/tools/ahat/src/test-dump/Main.java
@@ -38,7 +38,7 @@
     boolean baseline = args.length > 1 && args[1].equals("--base");
 
     // Enable allocation tracking so we get stack traces in the heap dump.
-    DdmVmInternal.enableRecentAllocations(true);
+    DdmVmInternal.setRecentAllocationsTrackingEnabled(true);
 
     // Allocate the instance of DumpedStuff.
     stuff = new DumpedStuff(baseline);