Android Telemetry: automates devices running "user" build.
Rather than requiring manual intervention, we can use Get/SetProtectedFileContents. TEST=tools/telemetry/run_tests --browser=android-chrome TabConsoleTest BUG=175127 Review URL: https://chromiumcodereview.appspot.com/12218091 git-svn-id: http://src.chromium.org/svn/trunk/src/build@181943 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
35e2679e15
Коммит
37a91b3535
|
@ -694,8 +694,8 @@ class AndroidCommands(object):
|
|||
|
||||
def GetFileContents(self, filename, log_result=False):
|
||||
"""Gets contents from the file specified by |filename|."""
|
||||
return self.RunShellCommand('if [ -f "' + filename + '" ]; then cat "' +
|
||||
filename + '"; fi', log_result=log_result)
|
||||
return self.RunShellCommand('cat "%s" 2>/dev/null' % filename,
|
||||
log_result=log_result)
|
||||
|
||||
def SetFileContents(self, filename, contents):
|
||||
"""Writes |contents| to the file specified by |filename|."""
|
||||
|
@ -714,6 +714,23 @@ class AndroidCommands(object):
|
|||
i += 1
|
||||
return self.GetExternalStorage() + '/' + base_name % i
|
||||
|
||||
def CanAccessProtectedFileContents(self):
|
||||
"""Returns True if Get/SetProtectedFileContents would work via "su".
|
||||
|
||||
Devices running user builds don't have adb root, but may provide "su" which
|
||||
can be used for accessing protected files.
|
||||
"""
|
||||
return self.RunShellCommand('su -c echo') == ['']
|
||||
|
||||
def GetProtectedFileContents(self, filename, log_result=False):
|
||||
"""Gets contents from the protected file specified by |filename|.
|
||||
|
||||
This is less efficient than GetFileContents, but will work for protected
|
||||
files and device files.
|
||||
"""
|
||||
# Run the script as root
|
||||
return self.RunShellCommand('su -c cat "%s" 2> /dev/null' % filename)
|
||||
|
||||
def SetProtectedFileContents(self, filename, contents):
|
||||
"""Writes |contents| to the protected file specified by |filename|.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче