Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index c40870e40137971d8f3330ed66eddb7d9c1b4464..e03632821322608f75afeff4fa1ddf80e8b77ad2 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -1066,6 +1066,17 @@ class AndroidCommands(object): |
return False |
+ def TakeScreenshot(self, host_file): |
+ """Saves a screenshot image to |host_file| on the host. |
+ |
+ Args: |
+ host_file: Absolute path to the image file to store on the host. |
+ """ |
+ device_file = '%s/screenshot.png' % self.GetExternalStorage() |
+ self.RunShellCommand('/system/bin/screencap -p %s' % device_file) |
+ assert self._adb.Pull(device_file, host_file) |
+ assert os.path.exists(host_file) |
+ |
class NewLineNormalizer(object): |
"""A file-like object to normalize EOLs to '\n'. |