Merge "Fix multi-line hex dumping and add unit test."
diff --git a/Android.mk b/Android.mk
index 4d9f622..5ecbea3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -356,19 +356,19 @@
 .PHONY: use-art
 use-art:
 	adb root && sleep 3
-	adb shell setprop persist.sys.dalvik.vm.lib libart.so
+	adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
 	adb reboot
 
 .PHONY: use-artd
 use-artd:
 	adb root && sleep 3
-	adb shell setprop persist.sys.dalvik.vm.lib libartd.so
+	adb shell setprop persist.sys.dalvik.vm.lib.1 libartd.so
 	adb reboot
 
 .PHONY: use-dalvik
 use-dalvik:
 	adb root && sleep 3
-	adb shell setprop persist.sys.dalvik.vm.lib libdvm.so
+	adb shell setprop persist.sys.dalvik.vm.lib.1 libdvm.so
 	adb reboot
 
 ########################################################################
diff --git a/runtime/common_test.h b/runtime/common_test.h
index 5e6354e..fce3f3f 100644
--- a/runtime/common_test.h
+++ b/runtime/common_test.h
@@ -160,11 +160,7 @@
 
 #if defined(__arm__)
 
-
-#include <signal.h>
-#include <asm/sigcontext.h>
-#include <asm-generic/ucontext.h>
-
+#include <sys/ucontext.h>
 
 // A signal handler called when have an illegal instruction.  We record the fact in
 // a global boolean and then increment the PC in the signal context to return to
diff --git a/runtime/profiler.cc b/runtime/profiler.cc
index 0e73812..365c9c3 100644
--- a/runtime/profiler.cc
+++ b/runtime/profiler.cc
@@ -36,6 +36,11 @@
 #include "ScopedLocalRef.h"
 #include "thread.h"
 #include "thread_list.h"
+
+#ifdef HAVE_ANDROID_OS
+#include "cutils/properties.h"
+#endif
+
 #if !defined(ART_USE_PORTABLE_COMPILER)
 #include "entrypoints/quick/quick_entrypoints.h"
 #endif
@@ -259,6 +264,17 @@
     }
   }
 
+  // Only on target...
+#ifdef HAVE_ANDROID_OS
+  // Switch off profiler if the dalvik.vm.profiler property has value 0.
+  char buf[PROP_VALUE_MAX];
+  property_get("dalvik.vm.profiler", buf, "0");
+  if (strcmp(buf, "0") == 0) {
+    LOG(INFO) << "Profiler disabled.  To enable setprop dalvik.vm.profiler 1";
+    return;
+  }
+#endif
+
   LOG(INFO) << "Starting profile with period " << period << "s, duration " << duration <<
       "s, interval " << interval_us << "us.  Profile file " << profile_file_name;