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

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

Issue 477953002: [Android] Fix misc minor provisioning issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/provision_devices.py ('k') | no next file » | 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.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 'content query --uri content://%s' % self._table, as_root=True): 43 'content query --uri content://%s' % self._table, as_root=True):
44 fields = row.split(', ') 44 fields = row.split(', ')
45 key = None 45 key = None
46 value = None 46 value = None
47 for field in fields: 47 for field in fields:
48 k, _, v = field.partition('=') 48 k, _, v = field.partition('=')
49 if k == 'name': 49 if k == 'name':
50 key = v 50 key = v
51 elif k == 'value': 51 elif k == 'value':
52 value = v 52 value = v
53 assert key, value 53 if not key:
54 continue
55 if not value:
56 value = ''
54 yield key, value 57 yield key, value
55 58
56 def __getitem__(self, key): 59 def __getitem__(self, key):
57 return self._device.RunShellCommand( 60 return self._device.RunShellCommand(
58 'content query --uri content://%s --where "name=\'%s\'" ' 61 'content query --uri content://%s --where "name=\'%s\'" '
59 '--projection value' % (self._table, key), as_root=True).strip() 62 '--projection value' % (self._table, key), as_root=True).strip()
60 63
61 def __setitem__(self, key, value): 64 def __setitem__(self, key, value):
62 if key in self: 65 if key in self:
63 self._device.RunShellCommand( 66 self._device.RunShellCommand(
(...skipping 11 matching lines...) Expand all
75 self._GetTypeBinding(value), value), 78 self._GetTypeBinding(value), value),
76 as_root=True) 79 as_root=True)
77 80
78 def __delitem__(self, key): 81 def __delitem__(self, key):
79 self._device.RunShellCommand( 82 self._device.RunShellCommand(
80 'content delete --uri content://%s ' 83 'content delete --uri content://%s '
81 '--bind name:%s:%s' % ( 84 '--bind name:%s:%s' % (
82 self._table, 85 self._table,
83 self._GetTypeBinding(key), key), 86 self._GetTypeBinding(key), key),
84 as_root=True) 87 as_root=True)
OLDNEW
« no previous file with comments | « build/android/provision_devices.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698