Bug 1285678 - Remove auth file before launching emulator; r=jmaher
Newer versions of the Android emulator check an 'auth' file on startup;
deleting the file avoids a user prompt to authorize use of the emulator.
--- a/testing/mozharness/scripts/android_emulator_unittest.py
+++ b/testing/mozharness/scripts/android_emulator_unittest.py
@@ -195,16 +195,25 @@ class AndroidEmulatorTest(BlobUploadMixi
# constructed in start_emulator.
env['LD_LIBRARY_PATH'] = self.abs_dirs['abs_work_dir']
# Write a default ddms.cfg to avoid unwanted prompts
avd_home_dir = self.abs_dirs['abs_avds_dir']
with open(os.path.join(avd_home_dir, "ddms.cfg"), 'w') as f:
f.write("pingOptIn=false\npingId=0\n")
+ # Delete emulator auth file, so it doesn't prompt
+ AUTH_FILE = os.path.join(os.path.expanduser('~'), '.emulator_console_auth_token')
+ if os.path.exists(AUTH_FILE):
+ try:
+ os.remove(AUTH_FILE)
+ self.info("deleted %s" % AUTH_FILE)
+ except:
+ self.warning("failed to remove %s" % AUTH_FILE)
+
# Set environment variables to help emulator find the AVD.
# In newer versions of the emulator, ANDROID_AVD_HOME should
# point to the 'avd' directory.
# For older versions of the emulator, ANDROID_SDK_HOME should
# point to the directory containing the '.android' directory
# containing the 'avd' directory.
env['ANDROID_AVD_HOME'] = os.path.join(avd_home_dir, 'avd')
env['ANDROID_SDK_HOME'] = os.path.abspath(os.path.join(avd_home_dir, '..'))