This pull request introduces several enhancements and new functionalities to the tools/python/util/android/android.py file, focusing on improving the management of Android emulators. The most important changes include adding a timeout parameter to the start_emulator function, adding checks to prevent multiple emulators from running simultaneously, and introducing new utility functions to manage emulator processes more effectively.
Enhancements to start_emulator function:
Added a timeout_minutes parameter to the start_emulator function to make the startup timeout configurable. [1][2]
Added a check to prevent starting a new emulator if one with the same AVD name is already running.
Included additional emulator arguments -verbose for better control and debugging.
Added a final verification step to ensure the emulator has started successfully.
New utility functions for managing emulator processes:
Introduced check_emulator_running_using_avd_name, check_emulator_running_using_process, and check_emulator_running_using_pid to check if an emulator is running based on AVD name, process instance, or PID, respectively.
Added stop_emulator_by_proc and stop_emulator_by_pid functions to stop the emulator process using a subprocess.Popen instance or PID, with a configurable timeout.
Updated the stop_emulator function to use the new utility functions for stopping the emulator process.
These changes enhance the robustness and flexibility of the emulator management utilities, making it easier to handle different scenarios in CI environments and development workflows.
Description
This pull request introduces several enhancements and new functionalities to the
tools/python/util/android/android.py
file, focusing on improving the management of Android emulators. The most important changes include adding a timeout parameter to thestart_emulator
function, adding checks to prevent multiple emulators from running simultaneously, and introducing new utility functions to manage emulator processes more effectively.Enhancements to
start_emulator
function:timeout_minutes
parameter to thestart_emulator
function to make the startup timeout configurable. [1] [2]-verbose
for better control and debugging.New utility functions for managing emulator processes:
check_emulator_running_using_avd_name
,check_emulator_running_using_process
, andcheck_emulator_running_using_pid
to check if an emulator is running based on AVD name, process instance, or PID, respectively.stop_emulator_by_proc
andstop_emulator_by_pid
functions to stop the emulator process using asubprocess.Popen
instance or PID, with a configurable timeout.stop_emulator
function to use the new utility functions for stopping the emulator process.These changes enhance the robustness and flexibility of the emulator management utilities, making it easier to handle different scenarios in CI environments and development workflows.
Motivation and Context