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

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

Issue 371813005: [Android] Switch to DeviceUtils versions of Ls, SetJavaAsserts, GetProp, and SetProp. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 class ContentSettings(dict): 6 class ContentSettings(dict):
7 7
8 """A dict interface to interact with device content settings. 8 """A dict interface to interact with device content settings.
9 9
10 System properties are key/value pairs as exposed by adb shell content. 10 System properties are key/value pairs as exposed by adb shell content.
11 """ 11 """
12 12
13 def __init__(self, table, device): 13 def __init__(self, table, device):
14 super(ContentSettings, self).__init__() 14 super(ContentSettings, self).__init__()
15 sdk_version_string = device.old_interface.system_properties[ 15 sdk_version_string = device.GetProp('ro.build.version.sdk')
16 'ro.build.version.sdk']
17 try: 16 try:
18 sdk_version = int(sdk_version_string) 17 sdk_version = int(sdk_version_string)
19 assert sdk_version >= 16, ( 18 assert sdk_version >= 16, (
20 'ContentSettings supported only on SDK 16 and later') 19 'ContentSettings supported only on SDK 16 and later')
21 except ValueError: 20 except ValueError:
22 assert False, ('Unknown SDK version %s' % sdk_version_string) 21 assert False, ('Unknown SDK version %s' % sdk_version_string)
23 self._table = table 22 self._table = table
24 self._device = device 23 self._device = device
25 24
26 @staticmethod 25 @staticmethod
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 self._GetTypeBinding(value), value), 75 self._GetTypeBinding(value), value),
77 as_root=True) 76 as_root=True)
78 77
79 def __delitem__(self, key): 78 def __delitem__(self, key):
80 self._device.RunShellCommand( 79 self._device.RunShellCommand(
81 'content delete --uri content://%s ' 80 'content delete --uri content://%s '
82 '--bind name:%s:%s' % ( 81 '--bind name:%s:%s' % (
83 self._table, 82 self._table,
84 self._GetTypeBinding(key), key), 83 self._GetTypeBinding(key), key),
85 as_root=True) 84 as_root=True)
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698