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

Unified Diff: build/android/pylib/device_settings.py

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/device_settings.py
diff --git a/build/android/pylib/device_settings.py b/build/android/pylib/device_settings.py
index 4050694ecdeaea653f1bdcd01f57c650fce7b16c..0580fcfdc3835a6ad319cd27ef0754247023413d 100644
--- a/build/android/pylib/device_settings.py
+++ b/build/android/pylib/device_settings.py
@@ -8,6 +8,8 @@ from pylib import constants
from pylib import content_settings
_LOCK_SCREEN_SETTINGS_PATH = '/data/system/locksettings.db'
+_ALTERNATE_LOCK_SCREEN_SETTINGS_PATH = (
+ '/data/data/com.android.providers.settings/databases/settings.db')
PASSWORD_QUALITY_UNSPECIFIED = '0'
@@ -66,16 +68,26 @@ def SetLockScreenSettings(device):
Raises:
Exception if the setting was not properly set.
"""
- if (not device.old_interface.FileExistsOnDevice(_LOCK_SCREEN_SETTINGS_PATH) or
- device.GetProp('ro.build.type') != 'userdebug'):
+ if device.GetProp('ro.build.type') != 'userdebug':
+ logging.warning('Unable to disable lockscreen on user builds.')
+ return
+
+ def get_lock_settings(table):
+ return [(table, 'lockscreen.disabled', '1'),
+ (table, 'lockscreen.password_type', PASSWORD_QUALITY_UNSPECIFIED),
+ (table, 'lockscreen.password_type_alternate',
+ PASSWORD_QUALITY_UNSPECIFIED)]
+
+ if device.FileExists(_LOCK_SCREEN_SETTINGS_PATH):
+ db = _LOCK_SCREEN_SETTINGS_PATH
+ locksettings = get_lock_settings('locksettings')
+ elif device.FileExists(_ALTERNATE_LOCK_SCREEN_SETTINGS_PATH):
+ db = _ALTERNATE_LOCK_SCREEN_SETTINGS_PATH
+ locksettings = get_lock_settings('secure') + get_lock_settings('system')
+ else:
+ logging.warning('Unable to find database file to set lock screen settings.')
return
- db = _LOCK_SCREEN_SETTINGS_PATH
- locksettings = [('locksettings', 'lockscreen.disabled', '1'),
- ('locksettings', 'lockscreen.password_type',
- PASSWORD_QUALITY_UNSPECIFIED),
- ('locksettings', 'lockscreen.password_type_alternate',
- PASSWORD_QUALITY_UNSPECIFIED)]
for table, key, value in locksettings:
# Set the lockscreen setting for default user '0'
columns = ['name', 'user', 'value']
@@ -91,9 +103,10 @@ commit transaction;""" % {
'columns': ', '.join(columns),
'values': ', '.join(["'%s'" % value for value in values])
}
- output_msg = device.RunShellCommand('sqlite3 %s "%s"' % (db, cmd))
+ output_msg = device.RunShellCommand('sqlite3 %s "%s"' % (db, cmd),
+ as_root=True)
if output_msg:
- print ' '.join(output_msg)
+ logging.info(' '.join(output_msg))
ENABLE_LOCATION_SETTINGS = [
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/gtest/filter/net_unittests_disabled » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698