Make runtest handle inner instrumentation class names.

Bug 7311518

Change-Id: I7c02991445a9fdd2341f54cfd49169fc4e492536
diff --git a/testrunner/adb_interface.py b/testrunner/adb_interface.py
index 1f1e3c6..fa394cd 100755
--- a/testrunner/adb_interface.py
+++ b/testrunner/adb_interface.py
@@ -305,7 +305,7 @@
       command_string += " -e %s '%s'" % (key, value)
     if raw_mode:
       command_string += " -r"
-    command_string += " -w %s" % instrumentation_path
+    command_string += " -w '%s'" % instrumentation_path
     return command_string
 
   def _CreateTraceDir(self):
diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py
index d3c5c9f..1bbedee 100644
--- a/testrunner/test_defs/instrumentation_test.py
+++ b/testrunner/test_defs/instrumentation_test.py
@@ -253,11 +253,13 @@
                     self.GetBuildPath()))
         return tests
       elif len(instrs) > 1:
-        logger.Log("Found multiple instrumentation declarations in %s/%s."
+        logger.Log("Found multiple instrumentation declarations in %s/%s. "
                    "Only using first declared." %
                    (self.GetBuildPath(),
                     android_manifest.AndroidManifest.FILENAME))
       instr_name = manifest_parser.GetInstrumentationNames()[0]
+      # escape inner class names
+      instr_name = instr_name.replace('$', '\$')
       pkg_name = manifest_parser.GetPackageName()
       if instr_name.find(".") < 0:
         instr_name = "." + instr_name
@@ -275,7 +277,7 @@
       # custom build steps
       if suite.GetPackageName().startswith('com.android.cts'):
         suite.SetSuite('cts')
-        tests.append(suite)
+      tests.append(suite)
       return tests
 
     except: