Skip to content

Commit

Permalink
Allow the agent to launch an app by package name.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705351651
  • Loading branch information
wichersn authored and The android_world Authors committed Dec 16, 2024
1 parent 47f0405 commit fdf406d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions android_world/env/adb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,12 @@ def launch_app(

activity = get_adb_activity(app_name)
if activity is None:
logging.error('Failed to launch app: %r', app_name)
return None
# If the app name is not in the mapping, assume it is a package name.
response = issue_generic_request(
['shell', 'monkey', '-p', app_name, '1'], env, timeout_sec=5
)
logging.info('Launching app by package name, response: %r', response)
return app_name
start_activity(activity, extra_args=[], env=env, timeout_sec=5)
return app_name

Expand Down

0 comments on commit fdf406d

Please sign in to comment.