diff --git a/android_env/components/config_classes.py b/android_env/components/config_classes.py index 528974f..9163bef 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 bca135b..dbff8a0 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):