Merge "Change IsMethodTracingActive to GetMethodTracingMode."
diff --git a/vm/Profile.cpp b/vm/Profile.cpp
index 08e1463..866311c 100644
--- a/vm/Profile.cpp
+++ b/vm/Profile.cpp
@@ -691,12 +691,18 @@
 }
 
 /*
- * Returns "true" if method tracing is currently active.
+ * Indicates if method tracing is active and what kind of tracing is active.
  */
-bool dvmIsMethodTraceActive()
+TracingMode dvmGetMethodTracingMode()
 {
     const MethodTraceState* state = &gDvm.methodTrace;
-    return state->traceEnabled;
+    if (!state->traceEnabled) {
+        return TRACING_INACTIVE;
+    } else if (state->samplingEnabled) {
+        return SAMPLE_PROFILING_ACTIVE;
+    } else {
+        return METHOD_TRACING_ACTIVE;
+    }
 }
 
 /*
diff --git a/vm/Profile.h b/vm/Profile.h
index 6a2c4be..9059181 100644
--- a/vm/Profile.h
+++ b/vm/Profile.h
@@ -87,10 +87,19 @@
  */
 void dvmMethodTraceStart(const char* traceFileName, int traceFd, int bufferSize,
         int flags, bool directToDdms, bool samplingEnabled, int intervalUs);
-bool dvmIsMethodTraceActive(void);
 void dvmMethodTraceStop(void);
 
 /*
+ * Returns current method tracing mode.
+ */
+enum TracingMode {
+    TRACING_INACTIVE,
+    METHOD_TRACING_ACTIVE,
+    SAMPLE_PROFILING_ACTIVE,
+};
+TracingMode dvmGetMethodTracingMode(void);
+
+/*
  * Start/stop emulator tracing.
  */
 void dvmEmulatorTraceStart(void);
diff --git a/vm/interp/Interp.cpp b/vm/interp/Interp.cpp
index 2b13bd8..42e2eca 100644
--- a/vm/interp/Interp.cpp
+++ b/vm/interp/Interp.cpp
@@ -1660,8 +1660,9 @@
     if (gDvm.instructionCountEnableCount > 0) {
         dvmEnableSubMode(thread, kSubModeInstCounting);
     }
-    if (dvmIsMethodTraceActive()) {
-        if (gDvm.methodTrace.samplingEnabled) {
+    TracingMode mode = dvmGetMethodTracingMode();
+    if (mode != TRACING_INACTIVE) {
+        if (mode == SAMPLE_PROFILING_ACTIVE) {
             dvmEnableSubMode(thread, kSubModeSampleTrace);
         } else {
             dvmEnableSubMode(thread, kSubModeMethodTrace);
diff --git a/vm/native/dalvik_system_VMDebug.cpp b/vm/native/dalvik_system_VMDebug.cpp
index 3ebf7c3..dae8997 100644
--- a/vm/native/dalvik_system_VMDebug.cpp
+++ b/vm/native/dalvik_system_VMDebug.cpp
@@ -300,16 +300,16 @@
 }
 
 /*
- * static boolean isMethodTracingActive()
+ * static int getMethodTracingMode()
  *
- * Determine whether method tracing is currently active.
+ * Determine whether method tracing is currently active and what type is active.
  */
-static void Dalvik_dalvik_system_VMDebug_isMethodTracingActive(const u4* args,
+static void Dalvik_dalvik_system_VMDebug_getMethodTracingMode(const u4* args,
     JValue* pResult)
 {
     UNUSED_PARAMETER(args);
 
-    RETURN_BOOLEAN(dvmIsMethodTraceActive());
+    RETURN_INT(dvmGetMethodTracingMode());
 }
 
 /*
@@ -787,8 +787,8 @@
         Dalvik_dalvik_system_VMDebug_startMethodTracingFd },
     { "startMethodTracingFilename", "(Ljava/lang/String;II)V",
         Dalvik_dalvik_system_VMDebug_startMethodTracingFilename },
-    { "isMethodTracingActive",      "()Z",
-        Dalvik_dalvik_system_VMDebug_isMethodTracingActive },
+    { "getMethodTracingMode",       "()I",
+        Dalvik_dalvik_system_VMDebug_getMethodTracingMode },
     { "stopMethodTracing",          "()V",
         Dalvik_dalvik_system_VMDebug_stopMethodTracing },
     { "startEmulatorTracing",       "()V",