Index: build/android/install_emulator_deps.py |
diff --git a/build/android/install_emulator_deps.py b/build/android/install_emulator_deps.py |
index e1dbe051797a9c8a6052b4e32b6a643893830152..0f40e9dad553b2f329a44dbd64a51809930fd1c0 100755 |
--- a/build/android/install_emulator_deps.py |
+++ b/build/android/install_emulator_deps.py |
@@ -19,6 +19,9 @@ from pylib import cmd_helper |
from pylib import constants |
from pylib.utils import run_tests_helper |
+# Android ARMv7 system image for the SDK. |
+ARMV7_IMG_URL = 'https://dl-ssl.google.com/android/repository/sysimg_armv7a-18_r01.zip' |
+ |
# Android x86 system image from the Intel website: |
# http://software.intel.com/en-us/articles/intel-eula-x86-android-4-2-jelly-bean-bin |
X86_IMG_URL = 'http://download-software.intel.com/sites/landingpage/android/sysimg_x86-18_r01.zip' |
@@ -37,6 +40,18 @@ def CheckSDK(): |
'android_tools')) |
+def CheckARMv7Image(): |
+ """Check if the ARMv7 system images have been installed. |
+ |
+ Returns: |
+ True if the armeabi-v7a directory is present inside the Android SDK |
+ checkout directory. |
+ """ |
+ return os.path.exists(os.path.join(constants.EMULATOR_SDK_ROOT, |
+ 'android_tools', 'sdk', 'system-images', |
+ API_TARGET, 'armeabi-v7a')) |
+ |
+ |
def CheckX86Image(): |
"""Check if Android system images have been installed. |
@@ -81,6 +96,21 @@ def InstallKVM(): |
'AMD SVM).') |
+def GetARMv7Image(): |
+ """Download and install the ARMv7 system image.""" |
+ logging.info('Download ARMv7 system image directory into sdk directory.') |
+ try: |
+ cmd_helper.RunCmd(['curl', '-o', '/tmp/armv7_img.zip', ARMV7_IMG_URL]) |
+ rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/armv7_img.zip', '-d', '/tmp/']) |
+ if rc: |
+ raise Exception('ERROR: Could not download/unzip image zip.') |
+ sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', |
+ 'system-images', API_TARGET, 'armeabi-v7a') |
+ shutil.move('/tmp/armeabi-v7a', sys_imgs) |
+ finally: |
+ os.unlink('/tmp/armv7_img.zip') |
+ |
+ |
def GetX86Image(): |
"""Download x86 system image from Intel's website.""" |
logging.info('Download x86 system image directory into sdk directory.') |
@@ -88,8 +118,7 @@ def GetX86Image(): |
cmd_helper.RunCmd(['curl', '-o', '/tmp/x86_img.zip', X86_IMG_URL]) |
rc = cmd_helper.RunCmd(['unzip', '-o', '/tmp/x86_img.zip', '-d', '/tmp/']) |
if rc: |
- logging.critical('ERROR: Could not download/unzip image zip.') |
- raise |
+ raise Exception('ERROR: Could not download/unzip image zip.') |
sys_imgs = os.path.join(constants.EMULATOR_SDK_ROOT, 'android_tools', 'sdk', |
'system-images', API_TARGET, 'x86') |
shutil.move('/tmp/x86', sys_imgs) |
@@ -110,11 +139,14 @@ def main(argv): |
'more information.') |
return 1 |
- logging.info('Emulator deps for ARM emulator complete.') |
- |
# Download system images only if needed. |
+ if CheckARMv7Image(): |
+ logging.info('The ARMv7 image is already present.') |
+ else: |
+ GetARMv7Image() |
+ |
if CheckX86Image(): |
- logging.info('system-images directory already exists.') |
+ logging.info('The x86 image is already present.') |
else: |
GetX86Image() |