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

Side by Side Diff: build/android/pylib/device/adb_wrapper.py

Issue 1134353002: Add --split-apk-path flag to apk_install.py, and install-multiple logic to adb_wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indentation Created 5 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « build/android/gyp/apk_install.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """This module wraps Android's adb tool. 5 """This module wraps Android's adb tool.
6 6
7 This is a thin wrapper around the adb interface. Any additional complexity 7 This is a thin wrapper around the adb interface. Any additional complexity
8 should be delegated to a higher level (ex. DeviceUtils). 8 should be delegated to a higher level (ex. DeviceUtils).
9 """ 9 """
10 10
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 if reinstall: 408 if reinstall:
409 cmd.append('-r') 409 cmd.append('-r')
410 if sd_card: 410 if sd_card:
411 cmd.append('-s') 411 cmd.append('-s')
412 cmd.append(apk_path) 412 cmd.append(apk_path)
413 output = self._RunDeviceAdbCmd(cmd, timeout, retries) 413 output = self._RunDeviceAdbCmd(cmd, timeout, retries)
414 if 'Success' not in output: 414 if 'Success' not in output:
415 raise device_errors.AdbCommandFailedError( 415 raise device_errors.AdbCommandFailedError(
416 cmd, output, device_serial=self._device_serial) 416 cmd, output, device_serial=self._device_serial)
417 417
418 def InstallMultiple(self, apk_paths, forward_lock=False, reinstall=False,
419 sd_card=False, allow_downgrade=False, partial=False,
420 timeout=60*2, retries=_DEFAULT_RETRIES):
421 """Install an apk with splits on the device.
422
423 Args:
424 apk_paths: Host path to the APK file.
425 forward_lock: (optional) If set forward-locks the app.
426 reinstall: (optional) If set reinstalls the app, keeping its data.
427 sd_card: (optional) If set installs on the SD card.
428 timeout: (optional) Timeout per try in seconds.
429 retries: (optional) Number of retries to attempt.
430 allow_downgrade: (optional) Allow versionCode downgrade.
431 partial: (optional) Package ID if apk_paths doesn't include all .apks.
432 """
433 for path in apk_paths:
434 _VerifyLocalFileExists(path)
435 cmd = ['install-multiple']
436 if forward_lock:
437 cmd.append('-l')
438 if reinstall:
439 cmd.append('-r')
440 if sd_card:
441 cmd.append('-s')
442 if allow_downgrade:
443 cmd.append('-d')
444 if partial:
445 cmd.extend(('-p', partial))
446 cmd.extend(apk_paths)
447 output = self._RunDeviceAdbCmd(cmd, timeout, retries)
448 if 'Success' not in output:
449 raise device_errors.AdbCommandFailedError(
450 cmd, output, device_serial=self._device_serial)
451
418 def Uninstall(self, package, keep_data=False, timeout=_DEFAULT_TIMEOUT, 452 def Uninstall(self, package, keep_data=False, timeout=_DEFAULT_TIMEOUT,
419 retries=_DEFAULT_RETRIES): 453 retries=_DEFAULT_RETRIES):
420 """Remove the app |package| from the device. 454 """Remove the app |package| from the device.
421 455
422 Args: 456 Args:
423 package: The package to uninstall. 457 package: The package to uninstall.
424 keep_data: (optional) If set keep the data and cache directories. 458 keep_data: (optional) If set keep the data and cache directories.
425 timeout: (optional) Timeout per try in seconds. 459 timeout: (optional) Timeout per try in seconds.
426 retries: (optional) Number of retries to attempt. 460 retries: (optional) Number of retries to attempt.
427 """ 461 """
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 @property 597 @property
564 def is_emulator(self): 598 def is_emulator(self):
565 return _EMULATOR_RE.match(self._device_serial) 599 return _EMULATOR_RE.match(self._device_serial)
566 600
567 @property 601 @property
568 def is_ready(self): 602 def is_ready(self):
569 try: 603 try:
570 return self.GetState() == _READY_STATE 604 return self.GetState() == _READY_STATE
571 except device_errors.CommandFailedError: 605 except device_errors.CommandFailedError:
572 return False 606 return False
573
OLDNEW
« no previous file with comments | « build/android/gyp/apk_install.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698