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 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if options.verbose: | 70 if options.verbose: |
71 logging.getLogger().setLevel(logging.DEBUG) | 71 logging.getLogger().setLevel(logging.DEBUG) |
72 | 72 |
73 if not options.device and len(android_commands.GetAttachedDevices()) > 1: | 73 if not options.device and len(android_commands.GetAttachedDevices()) > 1: |
74 parser.error('Multiple devices are attached. ' | 74 parser.error('Multiple devices are attached. ' |
75 'Please specify device serial number with --device.') | 75 'Please specify device serial number with --device.') |
76 | 76 |
77 if len(args) > 1: | 77 if len(args) > 1: |
78 parser.error('Too many positional arguments.') | 78 parser.error('Too many positional arguments.') |
79 host_file = args[0] if args else options.file | 79 host_file = args[0] if args else options.file |
80 adb = android_commands.AndroidCommands(options.device) | 80 adb = android_commands.AndroidCommands(options.device, api_strict_mode=True) |
81 | 81 |
82 if options.video: | 82 if options.video: |
83 _CaptureVideo(adb, host_file, options) | 83 _CaptureVideo(adb, host_file, options) |
84 else: | 84 else: |
85 _CaptureScreenshot(adb, host_file) | 85 _CaptureScreenshot(adb, host_file) |
86 return 0 | 86 return 0 |
87 | 87 |
88 | 88 |
89 if __name__ == '__main__': | 89 if __name__ == '__main__': |
90 sys.exit(main()) | 90 sys.exit(main()) |
OLD | NEW |