From 95f17702d74d06d8f61bc710c53472d25d2f92ed Mon Sep 17 00:00:00 2001 From: Sascha Bischoff Date: Tue, 10 Nov 2015 13:25:41 +0000 Subject: [PATCH] AndroidDevice: Move the processing of Android properties to an internal method - Move the processing of Android properties to an internal method. This allows the Android properties to be extracted without extracting those of the Linux device. - Redirect the output from 'dumpsys window' to a file and pull the file as opposed to extracting the output from the terminal. This is more reliable in the event that another process writes to the shell. --- wlauto/common/android/device.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wlauto/common/android/device.py b/wlauto/common/android/device.py index 17998e6d..ad9e7685 100644 --- a/wlauto/common/android/device.py +++ b/wlauto/common/android/device.py @@ -490,6 +490,11 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223 def get_properties(self, context): """Captures and saves the information from /system/build.prop and /proc/version""" props = super(AndroidDevice, self).get_properties(context) + props.update(self._get_android_properties(context)) + return props + + def _get_android_properties(self, context): + props = {} props['android_id'] = self.get_android_id() buildprop_file = os.path.join(context.host_working_directory, 'build.prop') if not os.path.isfile(buildprop_file): @@ -498,9 +503,8 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223 context.add_run_artifact('build_properties', buildprop_file, 'export') dumpsys_window_file = os.path.join(context.host_working_directory, 'window.dumpsys') - dumpsys_window_output = self.execute('dumpsys window') - with open(dumpsys_window_file, 'w') as wfh: - wfh.write(dumpsys_window_output) + self.execute('{} > {}'.format('dumpsys window', 'window.dumpsys')) + self.pull_file('window.dumpsys', dumpsys_window_file) context.add_run_artifact('dumpsys_window', dumpsys_window_file, 'meta') return props