Android Studio's emulator's "Virtual headset plug inserted" and its companion "Virtual microphone uses host audio input" stopped working for me as I transitioned from SDK 29 to 31.
Up until 29, when I plugged/unplugged a wired headset into my Win 10 HP laptop, the emulator produced the expected ACTION_HEADSET_PLUG intent, but the 31 emulator no longer does.
If I connect a real phone, it works fine, so the emulator is the suspect. I tried Pixel 3a and 4 MVDs, they both fail. I ran the 3a with 29, and that worked fine. I didn't tinker with the emulators, I use them as-is out of the box.
Numbers:
- Android Studio Chipmunk | 2021.2.1 Patch 1 Build
- #AI-212.5712.43.2112.8609683, built on May 18, 2022
- Runtime version: 11.0.12+7-b1504.28-7817840 amd64
- VM: OpenJDK 64-Bit Server VM by Oracle Corporation
- Windows 10 10.0
Any end of string will be greatly appreciated...
Looks like Android Studio sends audio device info type 15 TYPE_INFO_MIC, and no longer sends type 3. Figured this out by examining the audio device.