Thursday, September 26, 2019

Android P x86 System Images (Google Play, Google APIs) with ARM to x86 Translation - Canary

Android P x86 system images (Google Play, Google APIs) with ARM to x86 binary translation are  now available in the Canary channel, as rev 10 of Google APIs and rev 9 of Google Play.

x86 system images with translation versus ARM system images

Previously, Android app developers who needed to develop/test Android apps that used native ARM libraries could not use the x86-based emulator system images, and were forced to use system images with full ARM emulation, which are over 10x slower than the x86-based system images. Or, developers were forced to build or hunt down the x86 version in parallel. This is one of the top reasons app developers still resort to physical devices.

To address this, we've released P x86 system images that can also run apps with ARM native code. This leverages Google's ARM to x86 translation technology, which enables running native ARM apps at a much higher speed than with the actual ARM system images. App developers can then much more easily use the emulator to develop/test apps that are natively ARM or have native ARM dependencies. Note that the ARM to x86 translation technology enables the execution of intellectual property owned by Arm Limited. It will only be available on Google APIs and Play Store system images, and can only be used for application development and debug on x86 desktop, laptop, customer on-premise servers, and customer-procured cloud-based environments.

Why is x86 system with ARM to x86 translation faster?
The x86-based system images are fast due to leveraging CPU virtualization technologies such as HAXM and KVM, while the ARM system images are much slower due to having to emulate the entire stack, especially any system code and anything related to the memory management unit (MMU), which made basic memory read/write instructions very, very slow.

On the other hand, with an x86 system along with Google's ARM to x86 translation technology, we avoid the much more expensive system and MMU emulation, while only translating user-level code. This is a big win, as it allows memory accesses to proceed at near the original speed as if it were on x86, with the overhead confined to the bits related to instruction translation itself (and thus only being significant for CPU-bound apps (most apps being memory bandwidth or I/O bound)).

Known issues
  • Setting breakpoints in an ARM native library running in the translation environment is not supported. This is because the code that actually ends up running will be x86 code that is hard to map to the original ARM code in LLDB.
  • Since this is a technology that is getting new exposure and use cases, some app functionality may not work as expected. Please let us know of any issues through Issuetracker.
  • ARM64 is not yet supported.
  • This replaces any existing Android P x86 Google APIs / Google Play system image installation.