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