[autotest] Add a utility to install apk to an Android device

The method install_apk_from_build will use the job_repo_url of the host
to get build information, and install the given apk from the given build
artifact.

BUG=chromium:586320
TEST=local run test
modify testbed_DummyTest.py to install apk
from autotest_lib.server import adb_utils
adb_utils.install_apk_from_build(testbed.adb_devices['ZX1G22K3SQ'],
                                 'sl4a.apk', 'test_zip')
Run the test in local Autotest instance with a image, e.g.,
git_mnc-release/shamu-userdebug/LATEST
Confirm the apk is installed.

adb_utils.install_apk_from_build(
                testbed.adb_devices['ZX1G22K3SQ'], 'sl4a.apk', 'test_zip',
                package_name='com.googlecode.android_scripting',
                force_reinstall=True)
Confirm package is reinstalled
adb_utils.install_apk_from_build(
                testbed.adb_devices['ZX1G22K3SQ'], 'sl4a.apk', 'test_zip',
                package_name='no such package',
                force_reinstall=True)
Confirm the package install failed due to package not found.

Change-Id: I1b9aa7668a97e18f4cde5b6f1532e8e3c4d830ab
Reviewed-on: https://chromium-review.googlesource.com/328478
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
3 files changed