OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 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 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
8 | 8 |
9 Usage: | 9 Usage: |
10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 device_settings.ConfigureContentSettings( | 281 device_settings.ConfigureContentSettings( |
282 device, device_settings.DISABLE_MOCK_LOCATION_SETTINGS) | 282 device, device_settings.DISABLE_MOCK_LOCATION_SETTINGS) |
283 else: | 283 else: |
284 device_settings.ConfigureContentSettings( | 284 device_settings.ConfigureContentSettings( |
285 device, device_settings.ENABLE_MOCK_LOCATION_SETTINGS) | 285 device, device_settings.ENABLE_MOCK_LOCATION_SETTINGS) |
286 | 286 |
287 device_settings.SetLockScreenSettings(device) | 287 device_settings.SetLockScreenSettings(device) |
288 if options.disable_network: | 288 if options.disable_network: |
289 device_settings.ConfigureContentSettings( | 289 device_settings.ConfigureContentSettings( |
290 device, device_settings.NETWORK_DISABLED_SETTINGS) | 290 device, device_settings.NETWORK_DISABLED_SETTINGS) |
| 291 if device.build_version_sdk >= version_codes.MARSHMALLOW: |
| 292 # Ensure that NFC is also switched off. |
| 293 device.RunShellCommand(['svc', 'nfc', 'disable'], |
| 294 as_root=True, check_return=True) |
291 | 295 |
292 if options.disable_system_chrome: | 296 if options.disable_system_chrome: |
293 # The system chrome version on the device interferes with some tests. | 297 # The system chrome version on the device interferes with some tests. |
294 device.RunShellCommand(['pm', 'disable', 'com.android.chrome'], | 298 device.RunShellCommand(['pm', 'disable', 'com.android.chrome'], |
295 check_return=True) | 299 check_return=True) |
296 | 300 |
297 if options.remove_system_webview: | 301 if options.remove_system_webview: |
298 if any(device.PathExists(p) for p in _SYSTEM_WEBVIEW_PATHS): | 302 if any(device.PathExists(p) for p in _SYSTEM_WEBVIEW_PATHS): |
299 logging.info('System WebView exists and needs to be removed') | 303 logging.info('System WebView exists and needs to be removed') |
300 if device.HasRoot(): | 304 if device.HasRoot(): |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 devil_chromium.Initialize(adb_path=args.adb_path) | 550 devil_chromium.Initialize(adb_path=args.adb_path) |
547 | 551 |
548 try: | 552 try: |
549 return ProvisionDevices(args) | 553 return ProvisionDevices(args) |
550 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): | 554 except (device_errors.DeviceUnreachableError, device_errors.NoDevicesError): |
551 return exit_codes.INFRA | 555 return exit_codes.INFRA |
552 | 556 |
553 | 557 |
554 if __name__ == '__main__': | 558 if __name__ == '__main__': |
555 sys.exit(main()) | 559 sys.exit(main()) |
OLD | NEW |