@@ -162,10 +162,12 @@ class AndroidWorldController(base_wrapper.BaseWrapper):
162162 def __init__ (
163163 self ,
164164 env : env_interface .AndroidEnvInterface ,
165- a11y_method : A11yMethod = A11yMethod . A11Y_FORWARDER_APP ,
165+ a11y_method : A11yMethod | None = None ,
166166 install_a11y_forwarding_app : bool = True ,
167167 ):
168168 self ._original_env = env
169+ if a11y_method is None :
170+ a11y_method = A11yMethod .A11Y_FORWARDER_APP
169171 if a11y_method == A11yMethod .A11Y_FORWARDER_APP :
170172 self ._env = apply_a11y_forwarder_app_wrapper (
171173 env , install_a11y_forwarding_app
@@ -201,6 +203,7 @@ def refresh_env(self):
201203 console_port = self .env ._coordinator ._simulator ._config .emulator_launcher .emulator_console_port ,
202204 adb_path = self .env ._coordinator ._simulator ._config .adb_controller .adb_path ,
203205 grpc_port = self .env ._coordinator ._simulator ._config .emulator_launcher .grpc_port ,
206+ a11y_method = self ._a11y_method ,
204207 ).env
205208 # pylint: enable=protected-access
206209 # pytype: enable=attribute-error
@@ -308,6 +311,7 @@ def get_controller(
308311 console_port : int = 5554 ,
309312 adb_path : str = DEFAULT_ADB_PATH ,
310313 grpc_port : int = 8554 ,
314+ a11y_method : A11yMethod | None = None ,
311315) -> AndroidWorldController :
312316 """Creates a controller by connecting to an existing Android environment."""
313317
@@ -326,4 +330,4 @@ def get_controller(
326330 )
327331 android_env_instance = loader .load (config )
328332 logging .info ('Setting up AndroidWorldController.' )
329- return AndroidWorldController (android_env_instance )
333+ return AndroidWorldController (android_env_instance , a11y_method = a11y_method )
0 commit comments