Skip to content

Commit 721c3a1

Browse files
author
The android_world Authors
committed
APK installation failures will now raise an exception
PiperOrigin-RevId: 949134375
1 parent 3e50888 commit 721c3a1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

android_world/env/adb_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,10 +1056,15 @@ def install_apk(
10561056
10571057
Raises:
10581058
ValueError: If apk location does not exist.
1059+
RuntimeError: If the installation failed.
10591060
"""
10601061
if not os.path.exists(apk_location):
10611062
raise ValueError('APK does not exist.')
1062-
issue_generic_request(['install', apk_location], env, timeout_sec=30.0)
1063+
response = issue_generic_request(
1064+
['install', apk_location], env, timeout_sec=30.0
1065+
)
1066+
if response.status != adb_pb2.AdbResponse.Status.OK:
1067+
raise RuntimeError(f'Failed to install APK {apk_location}: {response}')
10631068

10641069

10651070
def check_airplane_mode(env: env_interface.AndroidEnvInterface) -> bool:

0 commit comments

Comments
 (0)