Make 'art' tool default to passing -XjdwpProvider:none

We usually don't want to be trying to connect to adbconnection when
using the 'art' tool. Make 'art' default to passing
-XjdwpProvider:none to dalvikvm. This can be overridden by passing
the --allow-default-jdwp option.

Test: art --verbose -cp classes.dex Main
Bug: 110073841
Change-Id: I0ffc3621d11fbc2368fe7111dcacbff2a0c50213
diff --git a/tools/art b/tools/art
index 781ee2f..62df7eb 100644
--- a/tools/art
+++ b/tools/art
@@ -22,6 +22,7 @@
 LAUNCH_WRAPPER=
 LIBART=libart.so
 JIT_PROFILE="no"
+ALLOW_DEFAULT_JDWP="no"
 VERBOSE="no"
 CLEAN_OAT_FILES="yes"
 EXTRA_OPTIONS=()
@@ -90,6 +91,8 @@
   --profile                Run with profiling, then run using profile data.
   --verbose                Run script verbosely.
   --no-clean               Don't cleanup oat directories.
+  --allow-default-jdwp     Don't automatically put in -XjdwpProvider:none.
+                           You probably do not want this.
 
 The ART_OPTIONS are passed directly to the Android Runtime.
 
@@ -306,6 +309,9 @@
   --no-clean)
     CLEAN_OAT_FILES="no"
     ;;
+  --allow-default-jdwp)
+    ALLOW_DEFAULT_JDWP="yes"
+    ;;
   --*)
     echo "unknown option: $1" 1>&2
     usage
@@ -357,6 +363,10 @@
   EXTRA_OPTIONS+=(-Xcompiler-option --generate-debug-info)
 fi
 
+if [ "$ALLOW_DEFAULT_JDWP" = "no" ]; then
+  EXTRA_OPTIONS+=(-XjdwpProvider:none)
+fi
+
 if [ "$JIT_PROFILE" = "yes" ]; then
   # Create the profile. The runtime expects profiles to be created before
   # execution.