fengelhardt
fengelhardt

Reputation: 1653

android emulator disable microphone when launching device

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

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

System Information:

Upvotes: 16

Views: 8305

Answers (2)

arturvt
arturvt

Reputation: 781

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

Upvotes: 32

fengelhardt
fengelhardt

Reputation: 1653

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.

Upvotes: 5

Related Questions