From 490dd404ae2e3341d5e0b81f033cbda40f721994 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Tue, 24 Jan 2017 17:52:51 +0000 Subject: [PATCH] AndroidDevice: write "dumpsys window" output on host On Android targets, WA collects device display information by running "dumpsys window" during run initialisation. Previously, this was redirectied into on-device file (under the working directory) and then pulled from the target. It looks like on Android-on-ChromeOS devices the redirect leads to an "Unknown Error" and the resulting file is empty. To get around that, this commit modfies the dumpsys command so that the output is collected directly from the shell's stdout and then writen on the host. --- wlauto/common/android/device.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wlauto/common/android/device.py b/wlauto/common/android/device.py index 351f7d8e..35c8a79d 100644 --- a/wlauto/common/android/device.py +++ b/wlauto/common/android/device.py @@ -550,11 +550,10 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223 props['android_id'] = self.get_android_id() self._update_build_properties(props) - dumpsys_target_file = self.path.join(self.working_directory, 'window.dumpsys') dumpsys_host_file = os.path.join(context.host_working_directory, 'window.dumpsys') - self.execute('{} > {}'.format('dumpsys window', dumpsys_target_file)) - self.pull_file(dumpsys_target_file, dumpsys_host_file) - context.add_run_artifact('dumpsys_window', dumpsys_host_file, 'meta') + with open(dumpsys_host_file, 'w') as wfh: + wfh.write(self.execute('dumpsys window')) + context.add_run_artifact('dumpsys_window', dumpsys_host_file, 'meta') prop_file = os.path.join(context.host_working_directory, 'android-props.json') with open(prop_file, 'w') as wfh: