[autotest] Added package uninstall.

BUG=None
TEST=Verified on moblab.

Change-Id: I6a9f0c7b12faa451f2d0301591d9bd4a9c4d453b
Reviewed-on: https://chromium-review.googlesource.com/371058
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
diff --git a/server/hosts/adb_host.py b/server/hosts/adb_host.py
index 7bc286f..8d22eba 100644
--- a/server/hosts/adb_host.py
+++ b/server/hosts/adb_host.py
@@ -1616,6 +1616,20 @@
             raise
 
 
+    def uninstall_package(self, package):
+        """Remove the specified package.
+
+        @param package: Android package name.
+
+        @raises GenericHostRunError: uninstall failed
+        """
+        result = self.adb_run('uninstall %s' % package)
+
+        if self.is_apk_installed(package):
+            raise error.GenericHostRunError('Uninstall of "%s" failed.'
+                                            % package, result)
+
+
     @retry.retry(error.GenericHostRunError, timeout_min=0.2)
     def _confirm_apk_installed(self, package_name):
         """Confirm if apk is already installed with the given name.