Add interface for updating the heap's process state
In the future, the heap's process state will be used
to determine GC behavior.
Change-Id: Iba4f038d28dbf483b6573d8feb25e4246ead1d50
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index ce3cc93..ce9dd4f 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -21,6 +21,7 @@
#include "debugger.h"
#include "dex_file-inl.h"
#include "gc/allocator/dlmalloc.h"
+#include "gc/heap.h"
#include "gc/space/dlmalloc_space.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
@@ -197,6 +198,10 @@
Runtime::Current()->GetHeap()->ConcurrentGC(self);
}
+static void VMRuntime_updateProcessState(JNIEnv* env, jobject, jint processState) {
+ Runtime::Current()->GetHeap()->UpdateProcessState(static_cast<gc::ProcessState>(processState));
+}
+
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"),
NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"),
@@ -214,6 +219,7 @@
NATIVE_METHOD(VMRuntime, trimHeap, "()V"),
NATIVE_METHOD(VMRuntime, vmVersion, "()Ljava/lang/String;"),
NATIVE_METHOD(VMRuntime, vmLibrary, "()Ljava/lang/String;"),
+ NATIVE_METHOD(VMRuntime, updateProcessState, "(I)V"),
};
void register_dalvik_system_VMRuntime(JNIEnv* env) {