1

Is there a way to determine which currently running application is using the microphone? I suspect the arrow launcher but would like to try and confirm this. I'm looking for a method which would provide logs / debug info to add to a bug report.

Android version 7.1. Rooted Nexus 5x.

I am not looking for another app to provide this functionality. I am a developer (though not Java) and would like to understand the processes involved in gaining access to and blocking the microphone.

here's the dump from dumpsys audio as requested by first answer:

 adb shell dumpsys audio

MediaFocusControl dump time: 12:43:52 pm

Audio Focus stack entries (last is top of stack):

 Notify on duck: true


Stream volumes (device: index)
- STREAM_VOICE_CALL:
   Muted: false
   Min: 1
   Max: 7
   Current: 1 (earpiece): 5, 40000000 (default): 5
   Devices: speaker
- STREAM_SYSTEM:
   Muted: false
   Min: 0
   Max: 7
   Current: 1 (earpiece): 5, 2 (speaker): 4, 40000000 (default): 5
   Devices: speaker
- STREAM_RING:
   Muted: false
   Min: 0
   Max: 7
   Current: 1 (earpiece): 5, 2 (speaker): 4, 40000000 (default): 5
   Devices: speaker
- STREAM_MUSIC:
   Muted: false
   Min: 0
   Max: 15
   Current: 4 (headset): 5, 8 (headphone): 5, 40000000 (default): 11
   Devices: speaker
- STREAM_ALARM:
   Muted: false
   Min: 0
   Max: 7
   Current: 40000000 (default): 6
   Devices: speaker
- STREAM_NOTIFICATION:
   Muted: false
   Min: 0
   Max: 7
   Current: 1 (earpiece): 5, 2 (speaker): 4, 40000000 (default): 5
   Devices: speaker
- STREAM_BLUETOOTH_SCO:
   Muted: false
   Min: 0
   Max: 15
   Current: 40000000 (default): 7
   Devices: speaker
- STREAM_SYSTEM_ENFORCED:
   Muted: false
   Min: 0
   Max: 7
   Current: 1 (earpiece): 5, 2 (speaker): 4, 40000000 (default): 5
   Devices: speaker
- STREAM_DTMF:
   Muted: false
   Min: 0
   Max: 15
   Current: 1 (earpiece): 11, 2 (speaker): 9, 40000000 (default): 11
   Devices: speaker
- STREAM_TTS:
   Muted: false
   Min: 0
   Max: 15
   Current: 4 (headset): 5, 8 (headphone): 5, 40000000 (default): 11
   Devices: speaker

- mute affected streams = 0x2e

Ringer mode: 
- mode (internal) = NORMAL
- mode (external) = NORMAL
- ringer mode affected streams = 0x1a6 (STREAM_SYSTEM,STREAM_RING,STREAM_NOTIFICATION,STREAM_SYSTEM_ENFORCED,STREAM_DTMF)
- ringer mode muted streams = 0x0
- delegate = ZenModeHelper

Audio routes:
  mMainType=0x0
  mBluetoothName=null

Other state:
  mVolumeController=VolumeController(android.os.BinderProxy@2e64f54,mVisible=false)
  mSafeMediaVolumeState=SAFE_MEDIA_VOLUME_INACTIVE
  mSafeMediaVolumeIndex=50
  mPendingVolumeCommand=null
  mMusicActiveMs=1500001
  mMcc=234
  mCameraSoundForced=false
  mHasVibrator=true
  mControllerService={mUid=0,mComponent=null}
  mVolumePolicy=VolumePolicy[volumeDownToEnterSilent=true,volumeUpToExitSilent=true,doNotDisturbWhenSilent=true,vibrateToSilentDebounce=400]

I have also tried:

adb shell dumpsys activity broadcasts | grep -i microphone

This gives no output.

1

I'm unsure about Nougat but this works for Android 6.0.1. Run:

adb shell dumpsys audio 

In the output look under Audio Focus stack entries (last is top of stack). E.g., when I had an audio recorder app using microphone, the output was:

Audio Focus stack entries (last is top of stack):
  source:android.os.BinderProxy@a60844c -- pack: com.sonymobile.androidapp.audiorecorder -- client: android.media.AudioManager@a251d71com.sonymobile.androidapp.audiorecorder.shared.media.VolumeControl@72c2756 -- gain: GAIN -- flags:  -- loss: none -- uid: 10108 -- attr: AudioAttributes: usage=1 content=2 flags=0x0 tags=

Here the package using the microphone is com.sonymobile.androidapp.audiorecorder.

1

Using logcat extreme and monitoring per app set to WhatsApp , it shows

mediaFocuscontrol: Audiofocus*request*Audiofocus() from Android.media.audiomanager when microphone is activated

And

mediaFocuscontrol: Audiofocus*abandon*Audiofocus() from Android.media.audiomanager when microphone is de-activated

  • I'm not sure how installing another app which blocks the microphone is going to help in this situation. It is already blocked. But thanks for the suggestion. – codecowboy Jul 31 '17 at 11:32
  • 1
    That app was to give an alert when mic activated. Posted logcat approach -not sure if that serves your purpose fully – beeshyams Jul 31 '17 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.