OLD | NEW |
| (Empty) |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import logging | |
6 | |
7 import content_settings | |
8 | |
9 | |
10 def ConfigureContentSettingsDict(adb, desired_settings): | |
11 """Configures device content setings from a dictionary. | |
12 | |
13 Many settings are documented at: | |
14 http://developer.android.com/reference/android/provider/Settings.Global.html | |
15 http://developer.android.com/reference/android/provider/Settings.Secure.html | |
16 http://developer.android.com/reference/android/provider/Settings.System.html | |
17 | |
18 Many others are undocumented. | |
19 | |
20 Args: | |
21 adb: An AndroidCommands instance for the device to configure. | |
22 desired_settings: A dict of {table: {key: value}} for all | |
23 settings to configure. | |
24 """ | |
25 for table, key_value in sorted(desired_settings.iteritems()): | |
26 settings = content_settings.ContentSettings(table, adb) | |
27 for key, value in key_value.iteritems(): | |
28 settings[key] = value | |
29 logging.info('\n%s %s', table, (80 - len(table)) * '-') | |
30 for key, value in sorted(settings.iteritems()): | |
31 logging.info('\t%s: %s', key, value) | |
32 | |
33 | |
34 DETERMINISTIC_DEVICE_SETTINGS = { | |
35 'com.google.settings/partner': { | |
36 'use_location_for_services': 1, | |
37 }, | |
38 'settings/global': { | |
39 # Disable "auto time" and "auto time zone" to avoid network-provided time | |
40 # to overwrite the device's datetime and timezone synchronized from host | |
41 # when running tests later. See b/6569849. | |
42 'auto_time': 0, | |
43 'auto_time_zone': 0, | |
44 | |
45 'stay_on_while_plugged_in': 3, | |
46 | |
47 'verifier_verify_adb_installs' : 0, | |
48 }, | |
49 'settings/secure': { | |
50 # Ensure that we never get random dialogs like "Unfortunately the process | |
51 # android.process.acore has stopped", which steal the focus, and make our | |
52 # automation fail (because the dialog steals the focus then mistakenly | |
53 # receives the injected user input events). | |
54 'anr_show_background': 0, | |
55 | |
56 # Ensure Geolocation is enabled and allowed for tests. | |
57 'location_providers_allowed': 'gps,network', | |
58 | |
59 'lockscreen.disabled': 1, | |
60 | |
61 'screensaver_enabled': 0, | |
62 }, | |
63 'settings/system': { | |
64 # Don't want devices to accidentally rotate the screen as that could | |
65 # affect performance measurements. | |
66 'accelerometer_rotation': 0, | |
67 | |
68 'lockscreen.disabled': 1, | |
69 | |
70 # Turn down brightness and disable auto-adjust so that devices run cooler. | |
71 'screen_brightness': 5, | |
72 'screen_brightness_mode': 0, | |
73 | |
74 'user_rotation': 0, | |
75 }, | |
76 } | |
77 | |
78 | |
79 NETWORK_DISABLED_SETTINGS = { | |
80 'settings/global': { | |
81 'airplane_mode_on': 1, | |
82 }, | |
83 } | |
OLD | NEW |