| OLD | NEW |
| 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 _LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db' | 9 _LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db' |
| 10 _ALTERNATE_LOCK_SCREEN_SETTINGS_PATH = ( | 10 _ALTERNATE_LOCK_SCREEN_SETTINGS_PATH = ( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 http://developer.android.com/reference/android/provider/Settings.Secure.html | 21 http://developer.android.com/reference/android/provider/Settings.Secure.html |
| 22 http://developer.android.com/reference/android/provider/Settings.System.html | 22 http://developer.android.com/reference/android/provider/Settings.System.html |
| 23 | 23 |
| 24 Many others are undocumented. | 24 Many others are undocumented. |
| 25 | 25 |
| 26 Args: | 26 Args: |
| 27 device: A DeviceUtils instance for the device to configure. | 27 device: A DeviceUtils instance for the device to configure. |
| 28 desired_settings: A list of (table, [(key: value), ...]) for all | 28 desired_settings: A list of (table, [(key: value), ...]) for all |
| 29 settings to configure. | 29 settings to configure. |
| 30 """ | 30 """ |
| 31 if device.build_type in _COMPATIBLE_BUILD_TYPES: | 31 for table, key_value in desired_settings: |
| 32 for table, key_value in desired_settings: | 32 settings = content_settings.ContentSettings(table, device) |
| 33 settings = content_settings.ContentSettings(table, device) | 33 for key, value in key_value: |
| 34 for key, value in key_value: | 34 settings[key] = value |
| 35 settings[key] = value | 35 logging.info('\n%s %s', table, (80 - len(table)) * '-') |
| 36 logging.info('\n%s %s', table, (80 - len(table)) * '-') | 36 for key, value in sorted(settings.iteritems()): |
| 37 for key, value in sorted(settings.iteritems()): | 37 logging.info('\t%s: %s', key, value) |
| 38 logging.info('\t%s: %s', key, value) | |
| 39 | 38 |
| 40 | 39 |
| 41 def SetLockScreenSettings(device): | 40 def SetLockScreenSettings(device): |
| 42 """Sets lock screen settings on the device. | 41 """Sets lock screen settings on the device. |
| 43 | 42 |
| 44 On certain device/Android configurations we need to disable the lock screen in | 43 On certain device/Android configurations we need to disable the lock screen in |
| 45 a different database. Additionally, the password type must be set to | 44 a different database. Additionally, the password type must be set to |
| 46 DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED. | 45 DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED. |
| 47 Lock screen settings are stored in sqlite on the device in: | 46 Lock screen settings are stored in sqlite on the device in: |
| 48 /data/system/locksettings.db | 47 /data/system/locksettings.db |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ('user_rotation', 0), | 188 ('user_rotation', 0), |
| 190 ]), | 189 ]), |
| 191 ] | 190 ] |
| 192 | 191 |
| 193 NETWORK_DISABLED_SETTINGS = [ | 192 NETWORK_DISABLED_SETTINGS = [ |
| 194 ('settings/global', [ | 193 ('settings/global', [ |
| 195 ('airplane_mode_on', 1), | 194 ('airplane_mode_on', 1), |
| 196 ('wifi_on', 0), | 195 ('wifi_on', 0), |
| 197 ]), | 196 ]), |
| 198 ] | 197 ] |
| OLD | NEW |