Friday, January 25, 2019

Emulator 28.1.4 Canary

Emulator 28.1.4 is now available in the Canary and Dev channels. Changes:
  • Host audio input disabled by default. A post on Reddit (https://www.reddit.com/r/androiddev/comments/aipv3i/til_the_android_emulator_responds_to_ok_google/) detailed how the guest Android OS would always be using the host microphone's audio, and thereby allowing "Ok Google" to work unexpectedly. We're quite sorry about this and will work with the Android team to make sure hotword detection is disabled in the system image as well. In the near term, to address this:
    • Actual host audio data is now squelched by default. When the guest uses the microphone, silence is passed over instead of the host's audio.
    • If it's desired to use the host audio data, there is now a toggle in the UI for that: Extended Controls > Microphone > "Virtual headset uses host audio input". The toggle reverts to disabling host audio whenever the emulator is restarted.
  • Note on CPU usage. In Project Marble investigations, we've noticed that high CPU usage on the emulator generally falls into the following categories:
    • At idle: Automatic app updates in Play Store images. We found that at random intervals, all apps installed get updated, even when the user is not logged in. During the process, CPU usage is driven to the number of cores x 100% (typically ~400%) in GMSCore and dex2oat. This can be mitigated by disabling auto app updates in the Play Store app.
    • At idle: Hotword detection. When on the home screen and without any app foregrounded, there can be a great deal of CPU usage (~25% with spikes to 50%). This is because of hotword detection always pinging the host. Note that this is not addressed by disabling host audio input, because the cost is dominated by the time taken to travel to the guest from the host, not the use of the host's audio itself. This can be mitigated by revoking microphone permissions for the Google app.
    • While active, sometimes at idle: Animations. The third source of high CPU usage is animations. We have found that by optimizing the graphics driver stack we can also reduce CPU usage here even when the emulator is not idle. We will be rolling out graphics driver optimizations incrementally as part of Project Marble.
    • While active: Video playback. Another source of high CPU usage is when video is playing. We are working to reduce the overhead of video decoding.
    • We welcome any further feedback on emulator resource usage and are working with teams in Android to better address the issues with app updates and hotword detection.