From 024eeb6f979a400f2315a68baa7a6a5ba094edfa Mon Sep 17 00:00:00 2001 From: bozowski Date: Thu, 19 Oct 2023 15:27:05 -0700 Subject: [PATCH] Bugreport --- .../idt/capture/platform/android/android.py | 15 +++++++++++++++ .../idt/capture/platform/android/config.py | 1 + 2 files changed, 16 insertions(+) diff --git a/src/tools/interop/idt/capture/platform/android/android.py b/src/tools/interop/idt/capture/platform/android/android.py index 1e1b54424e0dcb..ab537e9ba1dcc3 100644 --- a/src/tools/interop/idt/capture/platform/android/android.py +++ b/src/tools/interop/idt/capture/platform/android/android.py @@ -16,12 +16,14 @@ # import ipaddress +import os import traceback import typing from capture import log_format from capture.base import PlatformLogStreamer from capture.shell_utils import Bash +from . import config from . import streams from .capabilities import Capabilities @@ -179,6 +181,7 @@ async def connect(self) -> None: async def handle_stream_action(self, action: str) -> None: had_error = False for stream_name, stream in self.streams.items(): + self.logger.info(f"Doing {action} for {stream_name}!") try: await getattr(stream, action)() except: @@ -192,3 +195,15 @@ async def start_streaming(self) -> None: async def stop_streaming(self) -> None: await self.handle_stream_action("stop") + if config.enable_bug_report: + found = False + for item in os.listdir(self.artifact_dir): + if "bugreport" in item and ".zip" in item: + found = True + if not found: + self.logger.info("Taking bugreport") + self.run_adb_command("bugreport", cwd=self.artifact_dir) + else: + self.logger.warning("bugreport already taken") + else: + self.logger.critical("bugreport disabled in settings!") diff --git a/src/tools/interop/idt/capture/platform/android/config.py b/src/tools/interop/idt/capture/platform/android/config.py index 546433379f6830..2e9380e69d2dd6 100644 --- a/src/tools/interop/idt/capture/platform/android/config.py +++ b/src/tools/interop/idt/capture/platform/android/config.py @@ -16,3 +16,4 @@ # enable_build_push_tcpdump = True +enable_bug_report = True