From 2c581cfa91fa5fe08102644a94d5497bd4a8c9c0 Mon Sep 17 00:00:00 2001 From: Daniel Toyama Date: Tue, 29 Aug 2023 11:47:15 -0700 Subject: [PATCH] Remove `adb_server_port` from `EmulatorLauncher`. The emulator doesn't query the `ANDROID_ADB_SERVER_PORT` environment variable, so it shouldn't be set. We can then remove one confusing argument from `__init__()` since there's already an `adb_port`. PiperOrigin-RevId: 561095163 --- .../components/simulators/emulator/emulator_launcher.py | 4 ---- .../simulators/emulator/emulator_launcher_test.py | 6 ------ .../components/simulators/emulator/emulator_simulator.py | 1 - 3 files changed, 11 deletions(-) diff --git a/android_env/components/simulators/emulator/emulator_launcher.py b/android_env/components/simulators/emulator/emulator_launcher.py index c15993d..97266bb 100644 --- a/android_env/components/simulators/emulator/emulator_launcher.py +++ b/android_env/components/simulators/emulator/emulator_launcher.py @@ -30,7 +30,6 @@ def __init__( self, adb_path: str, adb_port: int | None = None, - adb_server_port: int | None = None, emulator_console_port: int | None = None, grpc_port: int = -1, emulator_path: str = '', @@ -50,7 +49,6 @@ def __init__( Args: adb_path: Filesystem path to `adb` executable binary. adb_port: ADB port for the Android device. - adb_server_port: Port of the ADB server deamon. emulator_console_port: Port for telnet communication with the emulator. grpc_port: Port for gRPC communication with the emulator. emulator_path: Path to the emulator binary. @@ -71,7 +69,6 @@ def __init__( self._adb_path = os.path.expandvars(adb_path) self._adb_port = adb_port - self._adb_server_port = adb_server_port self._emulator_console_port = emulator_console_port self._grpc_port = grpc_port self._emulator_path = os.path.expandvars(emulator_path) @@ -117,7 +114,6 @@ def launch_emulator_process(self) -> None: 'ANDROID_SDK_ROOT': self._android_sdk_root, 'ANDROID_AVD_HOME': self._android_avd_home, 'ANDROID_EMULATOR_KVM_DEVICE': self._kvm_device, - 'ANDROID_ADB_SERVER_PORT': str(self._adb_server_port), 'LD_LIBRARY_PATH': ld_library_path, 'QT_XKB_CONFIG_ROOT': str(self._emulator_path[:-8] + 'qt_config/'), 'ANDROID_EMU_ENABLE_CRASH_REPORTING': '1', diff --git a/android_env/components/simulators/emulator/emulator_launcher_test.py b/android_env/components/simulators/emulator/emulator_launcher_test.py index 20c248c..47e239f 100644 --- a/android_env/components/simulators/emulator/emulator_launcher_test.py +++ b/android_env/components/simulators/emulator/emulator_launcher_test.py @@ -34,7 +34,6 @@ def setUp(self): self._emulator_path = 'fake/path/emulator' self._adb_path = 'fake/path/adb' self._adb_port = 5554 - self._adb_server_port = 1234 self._emulator_console_port = 5555 self._avd_name = 'my_avd_name' @@ -64,7 +63,6 @@ def setUp(self): 'ANDROID_SDK_ROOT': '', 'ANDROID_AVD_HOME': '', 'ANDROID_EMULATOR_KVM_DEVICE': '/dev/kvm', - 'ANDROID_ADB_SERVER_PORT': '1234', 'LD_LIBRARY_PATH': ld_library_path, 'QT_XKB_CONFIG_ROOT': str(self._emulator_path[:-8] + 'qt_config/'), 'ANDROID_EMU_ENABLE_CRASH_REPORTING': '1', @@ -89,7 +87,6 @@ def test_launch( launcher = emulator_launcher.EmulatorLauncher( adb_path=self._adb_path, adb_port=self._adb_port, - adb_server_port=self._adb_server_port, emulator_console_port=self._emulator_console_port, emulator_path=self._emulator_path, avd_name=self._avd_name, @@ -131,7 +128,6 @@ def test_grpc_port( launcher = emulator_launcher.EmulatorLauncher( adb_path=self._adb_path, adb_port=self._adb_port, - adb_server_port=self._adb_server_port, emulator_console_port=self._emulator_console_port, emulator_path=self._emulator_path, avd_name=self._avd_name, @@ -176,7 +172,6 @@ def test_snapshot( launcher = emulator_launcher.EmulatorLauncher( adb_path=self._adb_path, adb_port=self._adb_port, - adb_server_port=self._adb_server_port, emulator_console_port=self._emulator_console_port, emulator_path=self._emulator_path, avd_name=self._avd_name, @@ -224,7 +219,6 @@ def test_network_restrict( launcher = emulator_launcher.EmulatorLauncher( adb_path=self._adb_path, adb_port=self._adb_port, - adb_server_port=self._adb_server_port, emulator_console_port=self._emulator_console_port, emulator_path=self._emulator_path, avd_name=self._avd_name, diff --git a/android_env/components/simulators/emulator/emulator_simulator.py b/android_env/components/simulators/emulator/emulator_simulator.py index f27127b..1873a3f 100644 --- a/android_env/components/simulators/emulator/emulator_simulator.py +++ b/android_env/components/simulators/emulator/emulator_simulator.py @@ -181,7 +181,6 @@ def __init__( emulator_launcher_args.update({ 'adb_path': self._adb_controller_args['adb_path'], 'adb_port': self._adb_port, - 'adb_server_port': self._adb_controller_args['adb_server_port'], 'emulator_console_port': self._console_port, 'grpc_port': self._grpc_port, 'tmp_dir': tmp_dir,