From 28a3b01ec4720a7fd18824c66dfedf543f04a250 Mon Sep 17 00:00:00 2001 From: Daniel Toyama Date: Wed, 8 Jul 2026 11:28:21 -0700 Subject: [PATCH] Add "Stats for Nerds" overlay to Playground web UI and reduce console log spam. PiperOrigin-RevId: 944607136 --- android_env/components/config_classes.py | 5 +++++ .../components/simulators/emulator/emulator_launcher.py | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/android_env/components/config_classes.py b/android_env/components/config_classes.py index 528974f5..9163beff 100644 --- a/android_env/components/config_classes.py +++ b/android_env/components/config_classes.py @@ -161,6 +161,11 @@ class EmulatorConfig(SimulatorConfig): # The number of times to try launching the emulator before reinstalling # (reinstall on the n+1-st try). launch_n_times_without_reinstall: int = 2 + # If True, use the raw on-device server instead of EmulatorSimulator. + use_raw_server: bool = False + # If True, enable audio capture from the device. Only applicable if + # use_raw_server is True. + enable_audio: bool = False @dataclasses.dataclass diff --git a/android_env/components/simulators/emulator/emulator_launcher.py b/android_env/components/simulators/emulator/emulator_launcher.py index bca135b4..dbff8a0a 100644 --- a/android_env/components/simulators/emulator/emulator_launcher.py +++ b/android_env/components/simulators/emulator/emulator_launcher.py @@ -17,6 +17,7 @@ import glob import os +import shutil import subprocess import tempfile @@ -164,8 +165,14 @@ def confirm_shutdown(self) -> None: def close(self): """Clean up launcher files and processes.""" if not self._is_closed: - self._local_tmp_dir_handle.cleanup() self.confirm_shutdown() + if os.path.exists(self._logfile_path): + try: + shutil.copyfile(self._logfile_path, '/tmp/emulator_output_debug') + logging.info('Copied emulator log to /tmp/emulator_output_debug') + except Exception as e: # pylint: disable=broad-exception-caught + logging.error('Failed to copy emulator log: %s', e) + self._local_tmp_dir_handle.cleanup() self._is_closed = True def __del__(self):