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

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

Issue 221823011: [Android] Change object types from AndroidCommands to DeviceUtils in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Frank's comments. Created 6 years, 8 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 content_settings 7 from pylib import content_settings
8 8
9 9
10 def ConfigureContentSettingsDict(adb, desired_settings): 10 def ConfigureContentSettingsDict(device, desired_settings):
11 """Configures device content setings from a dictionary. 11 """Configures device content setings from a dictionary.
12 12
13 Many settings are documented at: 13 Many settings are documented at:
14 http://developer.android.com/reference/android/provider/Settings.Global.html 14 http://developer.android.com/reference/android/provider/Settings.Global.html
15 http://developer.android.com/reference/android/provider/Settings.Secure.html 15 http://developer.android.com/reference/android/provider/Settings.Secure.html
16 http://developer.android.com/reference/android/provider/Settings.System.html 16 http://developer.android.com/reference/android/provider/Settings.System.html
17 17
18 Many others are undocumented. 18 Many others are undocumented.
19 19
20 Args: 20 Args:
21 adb: An AndroidCommands instance for the device to configure. 21 device: A DeviceUtils instance for the device to configure.
22 desired_settings: A dict of {table: {key: value}} for all 22 desired_settings: A dict of {table: {key: value}} for all
23 settings to configure. 23 settings to configure.
24 """ 24 """
25 try: 25 try:
26 sdk_version = int(adb.system_properties['ro.build.version.sdk']) 26 sdk_version = int(device.old_interface.system_properties[
27 'ro.build.version.sdk'])
27 except ValueError: 28 except ValueError:
28 logging.error('Skipping content settings configuration, unknown sdk %s', 29 logging.error('Skipping content settings configuration, unknown sdk %s',
29 adb.system_properties['ro.build.version.sdk']) 30 device.old_interface.system_properties[
31 'ro.build.version.sdk'])
30 return 32 return
31 33
32 if sdk_version < 16: 34 if sdk_version < 16:
33 logging.error('Skipping content settings configuration due to outdated sdk') 35 logging.error('Skipping content settings configuration due to outdated sdk')
34 return 36 return
35 37
36 for table, key_value in sorted(desired_settings.iteritems()): 38 for table, key_value in sorted(desired_settings.iteritems()):
37 settings = content_settings.ContentSettings(table, adb) 39 settings = content_settings.ContentSettings(table, device)
38 for key, value in key_value.iteritems(): 40 for key, value in key_value.iteritems():
39 settings[key] = value 41 settings[key] = value
40 logging.info('\n%s %s', table, (80 - len(table)) * '-') 42 logging.info('\n%s %s', table, (80 - len(table)) * '-')
41 for key, value in sorted(settings.iteritems()): 43 for key, value in sorted(settings.iteritems()):
42 logging.info('\t%s: %s', key, value) 44 logging.info('\t%s: %s', key, value)
43 45
44 46
45 DETERMINISTIC_DEVICE_SETTINGS = { 47 DETERMINISTIC_DEVICE_SETTINGS = {
46 'com.google.settings/partner': { 48 'com.google.settings/partner': {
47 'use_location_for_services': 1, 49 'use_location_for_services': 1,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 'user_rotation': 0, 87 'user_rotation': 0,
86 }, 88 },
87 } 89 }
88 90
89 91
90 NETWORK_DISABLED_SETTINGS = { 92 NETWORK_DISABLED_SETTINGS = {
91 'settings/global': { 93 'settings/global': {
92 'airplane_mode_on': 1, 94 'airplane_mode_on': 1,
93 }, 95 },
94 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698