[autotest] Ensure sl4a.apk is installed when running android_ACTS

Updates the android_ACTS test to ensure that sl4a is installed,
and if it is not installed and the device is within the lab
infrastructure then install it.

BUG=chromium:588348
TEST=Ran ./test_droid.py ZX1G22LL54,ZX1G22HV3T android_ACTS.BluetoothTest \
--remote android1758-row1-rack7-blth-test-station-1.cros and ensured the
test did not error out.

Change-Id: I332e5f7939dc1b29ec3a38e40049e2c46ae7229f
Reviewed-on: https://chromium-review.googlesource.com/328782
Commit-Ready: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/site_tests/android_ACTS/android_ACTS.py b/server/site_tests/android_ACTS/android_ACTS.py
index fb2f641..21ac039 100644
--- a/server/site_tests/android_ACTS/android_ACTS.py
+++ b/server/site_tests/android_ACTS/android_ACTS.py
@@ -9,6 +9,7 @@
 import common
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.common_lib import global_config
+from autotest_lib.server import adb_utils
 from autotest_lib.server import test
 
 
@@ -17,6 +18,9 @@
 
 TEST_CONFIG_FILE_FOLDER = 'autotest_config'
 TEST_CAMPAIGN_FILE_FOLDER = 'autotest_campaign'
+SL4A_APK = 'sl4a.apk'
+SL4A_BUILD_ARTIFACT = 'test_zip'
+SL4A_PACKAGE = 'com.googlecode.android_scripting'
 
 class android_ACTS(test.test):
     """Run an Android CTS test case.
@@ -70,6 +74,10 @@
         @param test_case: A string that's passed to act.py's -tc option.
         @param test_file: A string that's passed to act.py's -tf option.
         """
+        for serial, adb_host in testbed.get_adb_devices().iteritems():
+            adb_utils.install_apk_from_build(
+                    adb_host, SL4A_APK, SL4A_PACKAGE,
+                    package_name=SL4A_PACKAGE)
         self.test_station = testbed.get_test_station()
         # Get a tempfolder on the device.
         self.ts_tempfolder = self.test_station.get_tmp_dir()