skip to Main Content

How do we disable the (virtual) microphone when launching the emulator?

Situation
When launching an Android Studio stock emulator device, the microphone is always enabled and listening.

Why would we want this fix

  • Convenience, Many users have a microphone headset and when the microphone is enabled, they lose noise canceling and/or stereo. It can be extremely annoying, forcing the user to disconnect the device which swaps the emulator audio + sounds to another microphone/speaker input/output.
  • Security risk, the microphone is actively listening. Is the data going anywhere? Who knows…this is an unnecessary security risk for any organization, IE a dev is on a (zoom, teams, meetings) call with an open emulator that is using the microphone and listening).

Possible Solutions (based on practicality)

  1. flag to disable virtual audio devices (IE the mac’s speaker or attached headphones w/ a microphone). I’ve seen 0 documentation regarding a flag like this.
  2. flag to provide to the emulator to disable all audio input (see answer 1). TLDR add the flag -no-audio
  3. route the android studio emulator (or the mac’s microphone audio input) to a virtual device that is not listening. Or have the default OS microphone input set to 0 volume. This can be done via macOSX Automator
  4. route the adb emulator to the mac’s internal microphone instead of the current microphone to avoid it triggering the headsets microphone settings.

The preferred solution

  • Microphone audio-in is disabled when booting the emulator
  • Android device audio-out remains and uses the computer’s default speakers
  • The computer’s default microphone is not triggered (at all) to avoid causing a stereo -> mono swap or noise cancellation breakage.

System Information:

  • android emulator: 31.2.10.0
  • MacOS 12.3.1
  • Headsets tested with these issues:
    • Bose NC 700
    • Bose QC series
    • Sony WF-1000XM4
    • Sony WH-1000XM3
    • any headset with a microphone connection macro that does something with the speaker (like talk through) or with the input audio like stereo -> mono.

2

Answers


  1. Chosen as BEST ANSWER

    Partial solution based on the emulator's optional arguments which disables all audio in/out from the launched emulator.

    Running emulator -help-all the commands -no-audio and -noaudio are available to pass.

    These commands are the same and disable ALL audio, so no microphone or audio out from the emulator.

    Example command

    emulator -avd <name> -no-audio

    Pros: Running the above command, launches the emulator with the microphone disabled. Headsets and apps like microsnitch will not detect microphone activity.

    Cons: Clicking on the UI, or playing audio through the emulator will not play audio through the machine (or headset) speakers.


  2. You can try the approach from here:

    When I start Android Emulator, the audio on my Mac desktop stops
    It just works well.

    Set the values below into the config.ini from your emulator. It will never bother you again.

    hw.audioInput=no
    hw.audioOutput=no
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search