Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: build/android/pylib/device/device_utils.py

Issue 787803004: Update from https://crrev.com/307664 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index 403f235eabdc6877bc79e225ecdf9a83ee08b693..553e9602ffc0a9ebfba319bea746fc460e86b605 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -19,6 +19,7 @@ import zipfile
import pylib.android_commands
from pylib import cmd_helper
+from pylib import constants
from pylib.device import adb_wrapper
from pylib.device import decorators
from pylib.device import device_errors
@@ -42,7 +43,17 @@ def GetAVDs():
Returns:
A list containing the configured AVDs.
"""
- return pylib.android_commands.GetAVDs()
+ lines = cmd_helper.GetCmdOutput([
+ os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'android'),
+ 'list', 'avd']).splitlines()
+ avds = []
+ for line in lines:
+ if 'Name:' not in line:
+ continue
+ key, value = (s.strip() for s in line.split(':', 1))
+ if key == 'Name':
+ avds.append(value)
+ return avds
@decorators.WithExplicitTimeoutAndRetries(
@@ -343,30 +354,15 @@ class DeviceUtils(object):
DeviceUnreachableError on missing device.
"""
package_name = apk_helper.GetPackageName(apk_path)
- device_path = self.old_interface.GetApplicationPath(package_name)
+ device_path = self.GetApplicationPath(package_name)
if device_path is not None:
- files_changed = self.old_interface.GetFilesChanged(
- apk_path, device_path, ignore_filenames=True)
- if len(files_changed) > 0:
- should_install = True
- if not reinstall:
- out = self.old_interface.Uninstall(package_name)
- for line in out.splitlines():
- if 'Failure' in line:
- raise device_errors.CommandFailedError(line.strip(), str(self))
- else:
- should_install = False
+ should_install = bool(self._GetChangedFilesImpl(apk_path, device_path))
+ if should_install and not reinstall:
+ self.adb.Uninstall(package_name)
else:
should_install = True
if should_install:
- try:
- out = self.old_interface.Install(apk_path, reinstall=reinstall)
- for line in out.splitlines():
- if 'Failure' in line:
- raise device_errors.CommandFailedError(line.strip(), str(self))
- except AssertionError as e:
- raise device_errors.CommandFailedError(
- str(e), str(self)), None, sys.exc_info()[2]
+ self.adb.Install(apk_path, reinstall=reinstall)
@decorators.WithTimeoutAndRetriesFromInstance()
def RunShellCommand(self, cmd, check_return=False, cwd=None, env=None,
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698