Chromium Code Reviews| Index: build/android/pylib/android_commands.py |
| diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
| index e282ec86f1f144cbc6970520518c6cc0c9b259d4..5945aedc1fbdfa3875e2fade635499a8016b797e 100644 |
| --- a/build/android/pylib/android_commands.py |
| +++ b/build/android/pylib/android_commands.py |
| @@ -399,6 +399,9 @@ class AndroidCommands(object): |
| reboots_on_failure=2): |
| """Installs specified package and reboots device on timeouts. |
| + If package_name is supplied, checks if the package is already installed and |
| + doesn't reinstall if the apk md5sums match. |
| + |
| Args: |
| apk_path: Path to .apk file to install. |
| keep_data: Reinstalls instead of uninstalling first, preserving the |
| @@ -409,6 +412,14 @@ class AndroidCommands(object): |
| Returns: |
| A status string returned by adb install |
| """ |
| + # Check if package is already installed and up to date. |
| + if package_name: |
| + installed_apk_path = self.GetApplicationPath(package_name) |
| + if installed_apk_path and self.CheckMd5Sum(apk_path, installed_apk_path): |
| + logging.info('Skipped install: identical %s apk already installed' % |
| + package_name) |
| + return 'Success: identical %s apk already installed' % package_name |
|
frankf
2013/07/20 02:18:35
Why do we return a string in this method?
craigdh
2013/07/22 19:03:14
Yeah, I thought that was odd too. Doesn't look lik
|
| + # Install. |
| reboots_left = reboots_on_failure |
| while True: |
| try: |
| @@ -724,14 +735,12 @@ class AndroidCommands(object): |
| """ |
| self.RunShellCommand('input keyevent %d' % keycode) |
| - def CheckMd5Sum(self, local_path, device_path, ignore_paths=False): |
| + def CheckMd5Sum(self, local_path, device_path): |
| """Compares the md5sum of a local path against a device path. |
| Args: |
| local_path: Path (file or directory) on the host. |
| device_path: Path on the device. |
| - ignore_paths: If False, both the md5sum and the relative paths/names of |
| - files must match. If True, only the md5sum must match. |
| Returns: |
| True if the md5sums match. |