Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: build/android/pylib/device_settings.py

Issue 670183003: Update from chromium 62675d9fb31fb8cedc40f68e78e8445a74f362e7 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 6
7 from pylib import constants
7 from pylib import content_settings 8 from pylib import content_settings
8 9
9 _LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db' 10 _LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db'
10 PASSWORD_QUALITY_UNSPECIFIED = '0' 11 PASSWORD_QUALITY_UNSPECIFIED = '0'
11 12
12 13
13 def ConfigureContentSettings(device, desired_settings): 14 def ConfigureContentSettings(device, desired_settings):
14 """Configures device content setings from a list. 15 """Configures device content setings from a list.
15 16
16 Many settings are documented at: 17 Many settings are documented at:
17 http://developer.android.com/reference/android/provider/Settings.Global.html 18 http://developer.android.com/reference/android/provider/Settings.Global.html
18 http://developer.android.com/reference/android/provider/Settings.Secure.html 19 http://developer.android.com/reference/android/provider/Settings.Secure.html
19 http://developer.android.com/reference/android/provider/Settings.System.html 20 http://developer.android.com/reference/android/provider/Settings.System.html
20 21
21 Many others are undocumented. 22 Many others are undocumented.
22 23
23 Args: 24 Args:
24 device: A DeviceUtils instance for the device to configure. 25 device: A DeviceUtils instance for the device to configure.
25 desired_settings: A list of (table, [(key: value), ...]) for all 26 desired_settings: A list of (table, [(key: value), ...]) for all
26 settings to configure. 27 settings to configure.
27 """ 28 """
28 try: 29 try:
29 sdk_version = int(device.GetProp('ro.build.version.sdk')) 30 sdk_version = int(device.GetProp('ro.build.version.sdk'))
30 except ValueError: 31 except ValueError:
31 logging.error('Skipping content settings configuration, unknown sdk %s', 32 logging.error('Skipping content settings configuration, unknown sdk %s',
32 device.GetProp('ro.build.version.sdk')) 33 device.GetProp('ro.build.version.sdk'))
33 return 34 return
34 35
35 if sdk_version < 16: 36 if sdk_version < constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN:
36 logging.error('Skipping content settings configuration due to outdated sdk') 37 logging.error('Skipping content settings configuration due to outdated sdk')
37 return 38 return
38 39
39 if device.GetProp('ro.build.type') == 'userdebug': 40 if device.GetProp('ro.build.type') == 'userdebug':
40 for table, key_value in desired_settings: 41 for table, key_value in desired_settings:
41 settings = content_settings.ContentSettings(table, device) 42 settings = content_settings.ContentSettings(table, device)
42 for key, value in key_value: 43 for key, value in key_value:
43 settings[key] = value 44 settings[key] = value
44 logging.info('\n%s %s', table, (80 - len(table)) * '-') 45 logging.info('\n%s %s', table, (80 - len(table)) * '-')
45 for key, value in sorted(settings.iteritems()): 46 for key, value in sorted(settings.iteritems()):
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ('user_rotation', 0), 171 ('user_rotation', 0),
171 ]), 172 ]),
172 ] 173 ]
173 174
174 NETWORK_DISABLED_SETTINGS = [ 175 NETWORK_DISABLED_SETTINGS = [
175 ('settings/global', [ 176 ('settings/global', [
176 ('airplane_mode_on', 1), 177 ('airplane_mode_on', 1),
177 ('wifi_on', 0), 178 ('wifi_on', 0),
178 ]), 179 ]),
179 ] 180 ]
OLDNEW
« no previous file with comments | « build/android/pylib/content_settings.py ('k') | build/android/pylib/instrumentation/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698