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

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

Issue 255783008: Add option to wipe device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add parallel device reboot after wipe. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « build/android/provision_devices.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.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 'content query --uri content://%s' % self._table): 44 'content query --uri content://%s' % self._table):
45 fields = row.split(', ') 45 fields = row.split(', ')
46 key = None 46 key = None
47 value = None 47 value = None
48 for field in fields: 48 for field in fields:
49 k, _, v = field.partition('=') 49 k, _, v = field.partition('=')
50 if k == 'name': 50 if k == 'name':
51 key = v 51 key = v
52 elif k == 'value': 52 elif k == 'value':
53 value = v 53 value = v
54 print 'asserting %s, %s' % (key, value)
navabi 2014/04/29 07:53:28 remove this debugging print.
54 assert key, value 55 assert key, value
55 yield key, value 56 yield key, value
56 57
57 def __getitem__(self, key): 58 def __getitem__(self, key):
58 return self._device.old_interface.RunShellCommandWithSU( 59 return self._device.old_interface.RunShellCommandWithSU(
59 'content query --uri content://%s --where "name=\'%s\'" ' 60 'content query --uri content://%s --where "name=\'%s\'" '
60 '--projection value' % (self._table, key)).strip() 61 '--projection value' % (self._table, key)).strip()
61 62
62 def __setitem__(self, key, value): 63 def __setitem__(self, key, value):
63 if key in self: 64 if key in self:
64 self._device.old_interface.RunShellCommandWithSU( 65 self._device.old_interface.RunShellCommandWithSU(
65 'content update --uri content://%s ' 66 'content update --uri content://%s '
66 '--bind value:%s:%s --where "name=\'%s\'"' % ( 67 '--bind value:%s:%s --where "name=\'%s\'"' % (
67 self._table, 68 self._table,
68 self._GetTypeBinding(value), value, key)) 69 self._GetTypeBinding(value), value, key))
69 else: 70 else:
70 self._device.old_interface.RunShellCommandWithSU( 71 self._device.old_interface.RunShellCommandWithSU(
71 'content insert --uri content://%s ' 72 'content insert --uri content://%s '
72 '--bind name:%s:%s --bind value:%s:%s' % ( 73 '--bind name:%s:%s --bind value:%s:%s' % (
73 self._table, 74 self._table,
74 self._GetTypeBinding(key), key, 75 self._GetTypeBinding(key), key,
75 self._GetTypeBinding(value), value)) 76 self._GetTypeBinding(value), value))
76 77
77 def __delitem__(self, key): 78 def __delitem__(self, key):
78 self._device.old_interface.RunShellCommandWithSU( 79 self._device.old_interface.RunShellCommandWithSU(
79 'content delete --uri content://%s ' 80 'content delete --uri content://%s '
80 '--bind name:%s:%s' % ( 81 '--bind name:%s:%s' % (
81 self._table, 82 self._table,
82 self._GetTypeBinding(key), key)) 83 self._GetTypeBinding(key), key))
OLDNEW
« no previous file with comments | « build/android/provision_devices.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698