Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index f33534ba725065e67bef27af599c689c5f914b36..f0d4efdbab1811ddd370674f2ee65809d12ee99f 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -21,6 +21,7 @@ import time |
import cmd_helper |
import constants |
+import screenshot |
try: |
from pylib import pexpect |
except: |
@@ -1578,14 +1579,13 @@ class AndroidCommands(object): |
"""Saves a screenshot image to |host_file| on the host. |
Args: |
- host_file: Absolute path to the image file to store on the host. |
+ host_file: Absolute path to the image file to store on the host or None to |
+ use an autogenerated file name. |
+ |
+ Returns: |
+ Resulting host file name of the screenshot. |
""" |
- host_dir = os.path.dirname(host_file) |
- if not os.path.exists(host_dir): |
- os.makedirs(host_dir) |
- device_file = '%s/screenshot.png' % self.GetExternalStorage() |
- self.RunShellCommand('/system/bin/screencap -p %s' % device_file) |
- self.PullFileFromDevice(device_file, host_file) |
+ return screenshot.TakeScreenshot(self, host_file) |
def PullFileFromDevice(self, device_file, host_file): |
"""Download |device_file| on the device from to |host_file| on the host. |