Wednesday, May 1, 2019

Emulator 29.0.6 stable

Emulator 29.0.6 is now available in all channels.

Changes relative to previous stable versions, 28.0.23 and 28.0.25:

Removal of QEMU1 and 32-bit Windows Support

  • To better maintain the emulator, we now exclude shipping QEMU1 and 32-bit Windows binaries. Users who are on 32-bit Windows operating systems will not be upgraded to 29.0.6.
Support for Android Q
  • 29.0.6+ is required for running Android Q system images.
Project Marble Improvements
  • Blog post. We've made several changes to the emulator that are quality-oriented.
    • The major area of effort was dedicated to reducing resource usage of the emulator, especially CPU usage at idle.
    • We've also introduced quality-of-life changes that make it easier to work with the emulator in a wider variety of environments.
    • At the same time, we've continued to address general emulator quality issues.
    • The major Marble-related changes follow.
  • Host audio is now blocked from being passed to the emulator. To pass through host audio data, there is now a toggle in the UI: Extended Controls > Microphone > "Virtual microphone uses host audio input". More details
    • We also provide a command line and console command for toggling:
    • -allow-host-audio: Microphone activated on startup
    • adb emu avd hostmicon,  adb emu avd hostmicoff: Control whether host audio input is used.
  • Upgraded Qt UI libraries to 5.12 LTS.
    • Worked around crash in Qt's libpng decoding when starting certain system images; we now use our own copy of libpng to decode PNG images.
    • To address issues with some Linux installs containing incompatible versions of some Qt dependent libraries, we now package libfreetype, libsoftokn,  libsqlite3, and libxkbcommon with the emulator.
    • We no longer use Qt libraries to get the monitor dimensions as it is unreliable. Instead, we use the platform's native windowing libraries to do so.
  • To address CPU usage, we now run the following ADB commands on a cold boot when detecting boot complete:
    • adb shell settings put screen_off_timeout 214783647
    • adb shell pm revoke com.google.android.googlequicksearchbox android.permission.RECORD_AUDIO
    • More details
    • This is not applied to system images with API level < 26 as there is not a reliable boot complete signal communicated back to the host for those system images.
  • Added feature to immediately pause all vCPUs on the emulator via the following console commands:
    • adb emu avd pause
    • adb emu avd resume
  • Greatly reduced overhead of OpenGL drawing, which will help CPU usage when the emulator is playing animations.
  • Fixed twitching, incorrect frame display on Intel GPUs when running Q system images.
  • Fixed black screen when using Q system images with Pixel 2 XL skins, or any skin that had a notch or rounded corners.
  • Fixed issue where -partition-size command line option would not set the data partition size.
  • Restored support for mainline QEMU's e1000 virtual network device. This can be useful for using the emulator in a bridged network setup where one wants to seamlessly show the emulator on the host network, and vice versa with the host network on the emulator.
  • The QEMU 2.12-appropriate BIOS binaries are now used to start up the emulator.
  • Upgraded ffmpeg version to 3.4.5 for video encoding/decoding.
  • Fixed issue where pulseaudio on the Linx emulator would spin and take up an entire CPU core in some situations.
  • Greatly reduced overhead of QEMU main loop I/O on macOS via replacing the select()-based main loop with a kqueue-based main loop.
  • Logcat buffer size increased to 2M to address issues with flaky unexpected EOF when running logcat with the emulator.
  • Added a headless build of the emulator (more details here) which can run in a minimal-dependency environment without the UI. At the same time, we minimized the Linux system library dependency footprint of the headless build (more details). This can facilitate setup of the emulator in Docker or other CI environments.
    • Although the emulator binary with the -no-window flag is still available, the headless build is meant to supersede -no-window.
    • The headless build does not link pulseaudio nor X11. The system dependent shared libraries are the following minimal set:
    • linux-vdso.so.1
    • libutil.so.1
    • libm.so.6
    • libdl.so.2
    • librt.so.1
    • libpthread.so.0
    • libgcc_s.so.1
    • libc.so.6
    • ld-linux-x86-64.so.2
  • We now export the environment variable LC_ALL=C by default. This addresses crash and incompatibility issues associated from running the emulator in different locales.
  • We've added a way to track emulator CPU and RAM usage in Extended Controls > Settings > Advanced > Performance Stats. This provides a quick way to diagnose if the emulator seems to be using too much CPU or RAM.
  • Added performance monitoring environment variables SHOW_PERF_STATS=1 and ANDROID_EMU_TRACING=1. More details
  • Fixed out of bounds memory access when processing compressed textures.
  • Fixed GL error on host in glTexSubImage2D when updating certain gralloc buffers (with format RGB 565, RGB10A2, RGB(A)16F).
  • glReadPixels GL_IMPLEMENTATION_COLOR_READ_TYPE will now use the host GPU's result instead of an emulated one, which can fix issues with images/assets not showing up because of improper format for readback.
  • Added support for the OpenGL ES extensions GL_EXT_texture_format_BGRA8888 and GL_APPLE_texture_format_BGRA8888 if supported on the host.
  • Fixed display issue in Q system images with snapshots where the notification shade's geometry was rendered with an improper instance divisor setting.
  • Added more diagnostic info to the Bugreport UI and made emulator bugreports available from the console via
    • telnet localhost 5554
    • avd bugreport
  • Fixed a few hard-to-reproduce crash and freeze issues on launch that happened due to Qt losing signals or having flaky inconsistent states on startup.
  • Fixed many concurrency issues. We are now able to build the Linux emulator with ThreadSanitizer (TSAN), which can easily uncover flaky or "unreproducible" bugs.
  • On Android Q system images, we now bump the minimum RAM size to 2 GB.
  • We now add more logging and printing whenever OpenGL or hypervisor initialization fails.
  • Linux: We have found that on certain host kernels, the guest Android kernel can error out and exit in KVM with a "hardware error." We now abort() the emulator when this happens in order to increase debuggability (previously, it just hung).
  • Linux: For convenience with CI setups, added command line option -stdouterr-file <file-name> to redirect both stdout and stderr to a file.
  • To improve reliability of multiple emulator instances, if launching multiple instances of the emulator with -read-only, sometimes the previous writable emulator instance is not yet done cleaning up stale files. The emulator now retries to launch multiple instances 3 times over 3 seconds in that case.
  • On some remote desktop setups, it was possible to get a black screen when launching the emulator on Linux. We now explicitly configure MESA_RGB_VISUAL to avoid this. Details
  • Fixed incorrect usage of SO_REUSEADDR. Details
  • Fixed a long-standing issue with the Windows emulator where sub-processes (such as adb commands) failed to start if the username had spaces in it.
  • Fixed missing initialization of RCU in HAXM vCPU threads. This can possibly address some crashes and race conditions.
  • Fixed crash that happened in certain patterns of saving and loading snapshots from the snapshots UI in recent Q system images.
  • Fixed issue where virtual scene camera was blank because emulated device state would be initialized improperly from snapshot if an AR macro was playing while that snapshot was saved.
  • For upcoming system images, the emulator now supports Hardware Composer 2.0. This should result in lower driver overhead when running most animations.
  • The emulator build is now based on CMake/Ninja.
  • In the emulator extended controls UI, divider lines in the keyboard shortcuts table have been restored.
  • Fixed issue where rotate buttons would appear on TV AVDs. https://issuetracker.google.com/127956599
  • Fixed issue where if emulator was set always on top, the extended controls window would mysteriously appear every time the emulator was rotated. https://issuetracker.google.com/128455869
  • Metrics: We now send CPU/RAM usage metrics in a 10 second interval for opt-in users. This gives us a clearer picture of what are the real emulator resource usages in actual application.
Foldable Hardware Profiles
  • More details
  • Given that you are running Android Studio 3.5 Canary 10+, we now provide a set of foldable hardware profiles:
    • 7.3" Foldable: 1536x2152 unfolded, 4.6" 840x1960 folded
    • 8" Foldable: 2200x2480 unfolded, 6.6" 1480x2480 folded
  • A new button is added to the emulator toolbar to fold/unfold.
  • We also provide the keyboard shortcuts (Command on macOS) to fold/unfold:
    • Ctrl (Command on macOS) + F : Fold
    • Ctrl (Command on macOS) + U : Unfold
AR Macros
  • More details
  • The emulator can now play back from a set of preset motions in order to make it easier to test AR apps on the emulator.
  • The controls can be found in Extended Controls > Record and Playback > Macro Playback. When a macro is played back, the emulator's virtual sensors will generate values that reflect the motion, and the virtual scene camera will update according to the motion.
gRPC Streaming Emulator (Linux)
  • We'd like to make the emulator as versatile as possible, allowing host GPU rendering and interactivity in the widest range of running contexts. CI and remote desktop users have the following long-standing pain points:
    • Programmatically sending input commands to the emulator involves running adb shell commands which can be high overhead, or using the telnet console, which is faster, but may not work with certain network setups.
    • CI users often run emulators headless, which can make it difficult to notice issues that require the screen being visible or even interactive.
    • Remote desktop users often cannot run with host GPU rendering and also interact with the emulator as GPU rendering is often set up to be tied to the non-virtual displays.
  • To address this, we've added the capability for the Linux emulator to also serve a gRPC service. gRPC is a general framework for RPC that works over HTTP.
  • More details + setup guide

Vulkan Support (Windows, Linux)
  • Users can now test Vulkan apps with the Windows or Linux Android Emulator up to Vulkan 1.1 given a compatible system image (Android Q Beta 2 for Vulkan 1.0, Android Q Beta 3+ for Vulkan 1.1) and a compatible host GPU (Most Intel/NVIDIA/AMD GPUs from 2014 onwards).
  • It is currently behind a feature flag. To enable, append the following to ~/.android/advancedFeatures.ini (create if it does not exist):
    • Vulkan = on
    • GLDirectMem = on
  • Once these flags are enabled and running with a compatible host GPU and system image that supports Vulkan on the emulator (Q Beta 2+), Vulkan apps can be tested.
  • Snapshots with Vulkan enabled are still under development. If Vulkan gets activated, it will currently cause the quickboot snapshot to be invalidated.
  • ROM developers building the sdk_phone_x86 or sdk_phone_x86_64 (userdebug, eng variants) targets on AOSP master branch will also be able to use the emulator Vulkan driver. More details
  • Modern NVIDIA/AMD GPUs supporting Vulkan also support zero-copy interop with OpenGL via the GL_EXT_memory_objects extension, which we've leveraged to also provide a complete way to run the Skia Vulkan Android UI. If you have such a GPU, you can test the Skia Vulkan Android UI on Android Q Beta 3+:
    • adb shell
    • su
    • setprop debug.hwui.renderer skiavk
    • stop
    • start
  • macOS support is in progress, but needs far more work to be shippable. However, if you're interested in experimenting, we ship Swiftshader Vulkan on macOS along with MoltenVK and libportability (gfx-rs). Select with the following environment variables:
    • Swiftshader: ANDROID_EMU_VK_ICD=swiftshader
    • MoltenVK: ANDROID_EMU_VK_ICD=moltenvk
    • libportability: ANDROID_EMU_VK_ICD=portability
  • Known issue: HAXM can sometimes fail to map Vulkan coherent memory to the guest and shuts down the emulator. This will be addressed in an upcoming HAXM update.