| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Takes a screenshot or a screen video capture from an Android device.""" | 7 """Takes a screenshot or a screen video capture from an Android device.""" |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import optparse | 10 import optparse |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 from devil.android import device_blacklist |
| 15 from devil.android import device_errors |
| 16 from devil.android import device_utils |
| 14 from pylib import screenshot | 17 from pylib import screenshot |
| 15 from pylib.device import device_blacklist | |
| 16 from pylib.device import device_errors | |
| 17 from pylib.device import device_utils | |
| 18 | 18 |
| 19 def _PrintMessage(heading, eol='\n'): | 19 def _PrintMessage(heading, eol='\n'): |
| 20 sys.stdout.write('%s%s' % (heading, eol)) | 20 sys.stdout.write('%s%s' % (heading, eol)) |
| 21 sys.stdout.flush() | 21 sys.stdout.flush() |
| 22 | 22 |
| 23 | 23 |
| 24 def _CaptureScreenshot(device, host_file): | 24 def _CaptureScreenshot(device, host_file): |
| 25 host_file = device.TakeScreenshot(host_file) | 25 host_file = device.TakeScreenshot(host_file) |
| 26 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file)) | 26 _PrintMessage('Screenshot written to %s' % os.path.abspath(host_file)) |
| 27 | 27 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 if options.video: | 97 if options.video: |
| 98 _CaptureVideo(device, host_file, options) | 98 _CaptureVideo(device, host_file, options) |
| 99 else: | 99 else: |
| 100 _CaptureScreenshot(device, host_file) | 100 _CaptureScreenshot(device, host_file) |
| 101 return 0 | 101 return 0 |
| 102 | 102 |
| 103 | 103 |
| 104 if __name__ == '__main__': | 104 if __name__ == '__main__': |
| 105 sys.exit(main()) | 105 sys.exit(main()) |
| OLD | NEW |